Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe50382

Browse files
committed
Remove obsolete pg_attrdef.adsrc column
This has been deprecated and effectively unused for a long time.Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com>Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
1 parent8a99f8a commitfe50382

File tree

4 files changed

+4
-31
lines changed

4 files changed

+4
-31
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -947,27 +947,13 @@
947947
<entry><structfield>adbin</structfield></entry>
948948
<entry><type>pg_node_tree</type></entry>
949949
<entry></entry>
950-
<entry>The internal representation of the column default value</entry>
951-
</row>
952-
953-
<row>
954-
<entry><structfield>adsrc</structfield></entry>
955-
<entry><type>text</type></entry>
956-
<entry></entry>
957-
<entry>A human-readable representation of the default value</entry>
950+
<entry>The column default value, in <function>nodeToString()</function>
951+
representation. Use <literal>pg_get_expr(adbin, adrelid)</literal> to
952+
convert it to an SQL expression.</entry>
958953
</row>
959954
</tbody>
960955
</tgroup>
961956
</table>
962-
963-
<para>
964-
The <structfield>adsrc</structfield> field is historical, and is best
965-
not used, because it does not track outside changes that might affect
966-
the representation of the default value. Reverse-compiling the
967-
<structfield>adbin</structfield> field (with <function>pg_get_expr</function> for
968-
example) is a better way to display the default value.
969-
</para>
970-
971957
</sect1>
972958

973959

‎src/backend/catalog/heap.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,6 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
21522152
Node*expr,boolis_internal,booladd_column_mode)
21532153
{
21542154
char*adbin;
2155-
char*adsrc;
21562155
Relationadrel;
21572156
HeapTupletuple;
21582157
Datumvalues[4];
@@ -2169,21 +2168,12 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
21692168
*/
21702169
adbin=nodeToString(expr);
21712170

2172-
/*
2173-
* Also deparse it to form the mostly-obsolete adsrc field.
2174-
*/
2175-
adsrc=deparse_expression(expr,
2176-
deparse_context_for(RelationGetRelationName(rel),
2177-
RelationGetRelid(rel)),
2178-
false, false);
2179-
21802171
/*
21812172
* Make the pg_attrdef entry.
21822173
*/
21832174
values[Anum_pg_attrdef_adrelid-1]=RelationGetRelid(rel);
21842175
values[Anum_pg_attrdef_adnum-1]=attnum;
21852176
values[Anum_pg_attrdef_adbin-1]=CStringGetTextDatum(adbin);
2186-
values[Anum_pg_attrdef_adsrc-1]=CStringGetTextDatum(adsrc);
21872177

21882178
adrel=heap_open(AttrDefaultRelationId,RowExclusiveLock);
21892179

@@ -2198,10 +2188,8 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
21982188

21992189
/* now can free some of the stuff allocated above */
22002190
pfree(DatumGetPointer(values[Anum_pg_attrdef_adbin-1]));
2201-
pfree(DatumGetPointer(values[Anum_pg_attrdef_adsrc-1]));
22022191
heap_freetuple(tuple);
22032192
pfree(adbin);
2204-
pfree(adsrc);
22052193

22062194
/*
22072195
* Update the pg_attribute entry for the column to show that a default

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201810301
56+
#defineCATALOG_VERSION_NO201811011
5757

5858
#endif

‎src/include/catalog/pg_attrdef.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ CATALOG(pg_attrdef,2604,AttrDefaultRelationId)
3333

3434
#ifdefCATALOG_VARLEN/* variable-length fields start here */
3535
pg_node_treeadbinBKI_FORCE_NOT_NULL;/* nodeToString representation of default */
36-
textadsrcBKI_FORCE_NOT_NULL;/* human-readable representation of default */
3736
#endif
3837
}FormData_pg_attrdef;
3938

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp