diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-02-12 19:30:30 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-02-12 19:33:15 -0300 |
commit | 8237f27b504ff1d1e2da7ae4c81a7f72ea0e0e3e (patch) | |
tree | dd4faedb7b7d92e6c1f0ea7fade2eac487ccbc1c /src/backend/utils/adt/ruleutils.c | |
parent | 88ef48c1ccee6a2200e01318180cf521413b3012 (diff) | |
download | postgresql-8237f27b504ff1d1e2da7ae4c81a7f72ea0e0e3e.tar.gz postgresql-8237f27b504ff1d1e2da7ae4c81a7f72ea0e0e3e.zip |
get_relid_attribute_name is dead, long live get_attname
The modern way is to use a missing_ok argument instead of two separate
almost-identical routines, so do that.
Author: Michaël Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/20180201063212.GE6398@paquier.xyz
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 28767a129af..3bb468bdada 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -908,8 +908,8 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) if (i > 0) appendStringInfoString(&buf, ", "); - attname = get_relid_attribute_name(trigrec->tgrelid, - trigrec->tgattr.values[i]); + attname = get_attname(trigrec->tgrelid, + trigrec->tgattr.values[i], false); appendStringInfoString(&buf, quote_identifier(attname)); } } @@ -1292,7 +1292,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, char *attname; int32 keycoltypmod; - attname = get_relid_attribute_name(indrelid, attnum); + attname = get_attname(indrelid, attnum, false); if (!colno || colno == keyno + 1) appendStringInfoString(&buf, quote_identifier(attname)); get_atttypetypmodcoll(indrelid, attnum, @@ -1535,7 +1535,7 @@ pg_get_statisticsobj_worker(Oid statextid, bool missing_ok) if (colno > 0) appendStringInfoString(&buf, ", "); - attname = get_relid_attribute_name(statextrec->stxrelid, attnum); + attname = get_attname(statextrec->stxrelid, attnum, false); appendStringInfoString(&buf, quote_identifier(attname)); } @@ -1692,7 +1692,7 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags, char *attname; int32 keycoltypmod; - attname = get_relid_attribute_name(relid, attnum); + attname = get_attname(relid, attnum, false); appendStringInfoString(&buf, quote_identifier(attname)); get_atttypetypmodcoll(relid, attnum, &keycoltype, &keycoltypmod, @@ -2196,7 +2196,7 @@ decompile_column_index_array(Datum column_index_array, Oid relId, { char *colName; - colName = get_relid_attribute_name(relId, DatumGetInt16(keys[j])); + colName = get_attname(relId, DatumGetInt16(keys[j]), false); if (j == 0) appendStringInfoString(buf, quote_identifier(colName)); @@ -6015,8 +6015,9 @@ get_insert_query_def(Query *query, deparse_context *context) * tle->resname, since resname will fail to track RENAME. */ appendStringInfoString(buf, - quote_identifier(get_relid_attribute_name(rte->relid, - tle->resno))); + quote_identifier(get_attname(rte->relid, + tle->resno, + false))); /* * Print any indirection needed (subfields or subscripts), and strip @@ -6319,8 +6320,9 @@ get_update_query_targetlist_def(Query *query, List *targetList, * tle->resname, since resname will fail to track RENAME. */ appendStringInfoString(buf, - quote_identifier(get_relid_attribute_name(rte->relid, - tle->resno))); + quote_identifier(get_attname(rte->relid, + tle->resno, + false))); /* * Print any indirection needed (subfields or subscripts), and strip @@ -10340,8 +10342,8 @@ processIndirection(Node *node, deparse_context *context) * target lists, but this function cannot be used for that case. */ Assert(list_length(fstore->fieldnums) == 1); - fieldname = get_relid_attribute_name(typrelid, - linitial_int(fstore->fieldnums)); + fieldname = get_attname(typrelid, + linitial_int(fstore->fieldnums), false); appendStringInfo(buf, ".%s", quote_identifier(fieldname)); /* |