diff options
| author | Alvaro Herrera | 2017-04-17 21:34:29 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2017-04-17 21:34:29 +0000 |
| commit | ee6922112e9b3c02b995bd1d838c9a261f060133 (patch) | |
| tree | 2d8678c97967dbdccdfa692a4b75fdd5f21cbe06 /src/bin | |
| parent | 8c5cdb7f4f6e1d6a6104cb58ce4f23453891651b (diff) | |
Rename columns in new pg_statistic_ext catalog
The new catalog reused a column prefix "sta" from pg_statistic, but this
is undesirable, so change the catalog to use prefix "stx" instead.
Also, rename the column that lists enabled statistic kinds as "stxkind"
rather than "enabled".
Discussion: https://postgr.es/m/CAKJS1f_2t5jhSN7huYRFH3w3rrHfG2QU7hiUHsu-Vdjd1rYT3w@mail.gmail.com
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/pg_dump.c | 20 | ||||
| -rw-r--r-- | src/bin/psql/describe.c | 14 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 8824018786..e9b5c8a448 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -6663,8 +6663,8 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables) int ntups; int i_tableoid; int i_oid; - int i_staname; - int i_stadef; + int i_stxname; + int i_stxdef; /* Extended statistics were new in v10 */ if (fout->remoteVersion < 100000) @@ -6707,11 +6707,11 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables) "SELECT " "tableoid, " "oid, " - "staname, " - "pg_catalog.pg_get_statisticsextdef(oid) AS stadef " + "stxname, " + "pg_catalog.pg_get_statisticsextdef(oid) AS stxdef " "FROM pg_statistic_ext " - "WHERE starelid = '%u' " - "ORDER BY staname", tbinfo->dobj.catId.oid); + "WHERE stxrelid = '%u' " + "ORDER BY stxname", tbinfo->dobj.catId.oid); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -6719,8 +6719,8 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables) i_tableoid = PQfnumber(res, "tableoid"); i_oid = PQfnumber(res, "oid"); - i_staname = PQfnumber(res, "staname"); - i_stadef = PQfnumber(res, "stadef"); + i_stxname = PQfnumber(res, "stxname"); + i_stxdef = PQfnumber(res, "stxdef"); statsextinfo = (StatsExtInfo *) pg_malloc(ntups * sizeof(StatsExtInfo)); @@ -6730,10 +6730,10 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables) statsextinfo[j].dobj.catId.tableoid = atooid(PQgetvalue(res, j, i_tableoid)); statsextinfo[j].dobj.catId.oid = atooid(PQgetvalue(res, j, i_oid)); AssignDumpId(&statsextinfo[j].dobj); - statsextinfo[j].dobj.name = pg_strdup(PQgetvalue(res, j, i_staname)); + statsextinfo[j].dobj.name = pg_strdup(PQgetvalue(res, j, i_stxname)); statsextinfo[j].dobj.namespace = tbinfo->dobj.namespace; statsextinfo[j].statsexttable = tbinfo; - statsextinfo[j].statsextdef = pg_strdup(PQgetvalue(res, j, i_stadef)); + statsextinfo[j].statsextdef = pg_strdup(PQgetvalue(res, j, i_stxdef)); } PQclear(res); diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 59121b8d1b..0f9f497c66 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2344,16 +2344,16 @@ describeOneTableDetails(const char *schemaname, { printfPQExpBuffer(&buf, "SELECT oid, " - "stanamespace::pg_catalog.regnamespace AS nsp, " - "staname, stakeys,\n" + "stxnamespace::pg_catalog.regnamespace AS nsp, " + "stxname, stxkeys,\n" " (SELECT pg_catalog.string_agg(pg_catalog.quote_ident(attname),', ')\n" - " FROM pg_catalog.unnest(stakeys) s(attnum)\n" - " JOIN pg_catalog.pg_attribute a ON (starelid = a.attrelid AND\n" + " FROM pg_catalog.unnest(stxkeys) s(attnum)\n" + " JOIN pg_catalog.pg_attribute a ON (stxrelid = a.attrelid AND\n" " a.attnum = s.attnum AND NOT attisdropped)) AS columns,\n" - " (staenabled @> '{d}') AS ndist_enabled,\n" - " (staenabled @> '{f}') AS deps_enabled\n" + " (stxkind @> '{d}') AS ndist_enabled,\n" + " (stxkind @> '{f}') AS deps_enabled\n" "FROM pg_catalog.pg_statistic_ext stat " - "WHERE starelid = '%s'\n" + "WHERE stxrelid = '%s'\n" "ORDER BY 1;", oid); |
