Lists: | pgsql-committerspgsql-hackers |
---|
From: | momjian(at)postgresql(dot)org (Bruce Momjian) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Add column storage type to psql \d+ display. |
Date: | 2008-07-14 22:51:48 |
Message-ID: | 20080714225148.64BB7754A84@cvs.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Log Message:
-----------
Add column storage type to psql \d+ display.
Gregory Stark
Modified Files:
--------------
pgsql/src/bin/psql:
describe.c (r1.177 -> r1.178)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.c?r1=1.177&r2=1.178)
From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [COMMITTERS] pgsql: Add column storage type to psql \d+ display. |
Date: | 2008-07-17 14:39:42 |
Message-ID: | 20080717143942.GB3934@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Bruce Momjian wrote:
> Log Message:
> -----------
> Add column storage type to psql \d+ display.
I think this patch has caused this new warning in psql:
/pgsql//source/00head/src/bin/psql/describe.c: In function ‘describeOneTableDetails’:
/pgsql//source/00head/src/bin/psql/describe.c:832: warning: ‘tableinfo.relkind’ may be used uninitialized in this function
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [COMMITTERS] pgsql: Add column storage type to psql \d+ display. |
Date: | 2008-07-18 02:20:25 |
Message-ID: | 200807180220.m6I2KPl19471@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > Log Message:
> > -----------
> > Add column storage type to psql \d+ display.
>
> I think this patch has caused this new warning in psql:
>
> /pgsql//source/00head/src/bin/psql/describe.c: In function ?describeOneTableDetails?:
> /pgsql//source/00head/src/bin/psql/describe.c:832: warning: ?tableinfo.relkind? may be used uninitialized in this function
I don't see that warning with my compiler so I have no way of testing
this, but I do see this line pretty high in the function:
tableinfo.relkind = *(PQgetvalue(res, 0, 1));
Do you have any idea how relkind could be accessed before this
assignment? The line number is it complaining about is the definition
of relkind in the structure, not any reference to the variable.
The only crazy idea I have is that the variable name appears in a string
above the assignment:
"SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules, "
And relkind is the only column that matches a structure member.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: [COMMITTERS] pgsql: Add column storage type to psql \d+ display. |
Date: | 2008-07-18 03:35:57 |
Message-ID: | 20080718033557.GT3934@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > I think this patch has caused this new warning in psql:
> >
> > /pgsql//source/00head/src/bin/psql/describe.c: In function ?describeOneTableDetails?:
> > /pgsql//source/00head/src/bin/psql/describe.c:832: warning: ?tableinfo.relkind? may be used uninitialized in this function
>
> I don't see that warning with my compiler so I have no way of testing
> this, but I do see this line pretty high in the function:
>
> tableinfo.relkind = *(PQgetvalue(res, 0, 1));
But it's before the first "goto error_return", after which it is checked.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Re: [COMMITTERS] pgsql: Add column storage type to psql \d+ display. |
Date: | 2008-07-18 04:22:57 |
Message-ID: | 9729.1216354977@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Bruce Momjian wrote:
>> I don't see that warning with my compiler so I have no way of testing
>> this, but I do see this line pretty high in the function:
>> tableinfo.relkind = *(PQgetvalue(res, 0, 1));
> But it's before the first "goto error_return", after which it is checked.
Ah. That code is indeed broken, or at least risky in the extreme. What
the cleanup code ought to be checking is just whether or not the arrays
have gotten allocated yet. Checking a condition that should later lead
to the array getting allocated is just asking for trouble --- even if
there's not a "goto error_return" in between today, someday someone will
insert one.
Patch applied ...
regards, tom lane