Remove unnecessary and version-sensitive dependence on the exact set of
column names to be found in a sequence. Per gripe from Bruce.
This commit is contained in:
parent
7197706d81
commit
160a46720c
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
|
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.218 2009/06/13 13:43:34 petere Exp $
|
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.218.2.1 2009/07/20 03:46:53 tgl Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -1131,29 +1131,22 @@ describeOneTableDetails(const char *schemaname,
|
|||||||
*/
|
*/
|
||||||
if (tableinfo.relkind == 'S')
|
if (tableinfo.relkind == 'S')
|
||||||
{
|
{
|
||||||
PGresult *result;
|
printfPQExpBuffer(&buf, "SELECT * FROM %s", fmtId(schemaname));
|
||||||
|
|
||||||
#define SEQ_NUM_COLS 10
|
|
||||||
printfPQExpBuffer(&buf,
|
|
||||||
"SELECT sequence_name, last_value,\n"
|
|
||||||
" start_value, increment_by,\n"
|
|
||||||
" max_value, min_value, cache_value,\n"
|
|
||||||
" log_cnt, is_cycled, is_called\n"
|
|
||||||
"FROM %s",
|
|
||||||
fmtId(schemaname));
|
|
||||||
/* must be separate because fmtId isn't reentrant */
|
/* must be separate because fmtId isn't reentrant */
|
||||||
appendPQExpBuffer(&buf, ".%s", fmtId(relationname));
|
appendPQExpBuffer(&buf, ".%s", fmtId(relationname));
|
||||||
|
|
||||||
result = PSQLexec(buf.data, false);
|
res = PSQLexec(buf.data, false);
|
||||||
if (!result)
|
if (!res)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
|
||||||
seq_values = pg_malloc_zero((SEQ_NUM_COLS + 1) * sizeof(*seq_values));
|
seq_values = pg_malloc((PQnfields(res) + 1) * sizeof(*seq_values));
|
||||||
|
|
||||||
for (i = 0; i < SEQ_NUM_COLS; i++)
|
for (i = 0; i < PQnfields(res); i++)
|
||||||
seq_values[i] = pg_strdup(PQgetvalue(result, 0, i));
|
seq_values[i] = pg_strdup(PQgetvalue(res, 0, i));
|
||||||
|
seq_values[i] = NULL;
|
||||||
|
|
||||||
PQclear(result);
|
PQclear(res);
|
||||||
|
res = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get column info (index requires additional checks) */
|
/* Get column info (index requires additional checks) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user