mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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
This commit is contained in:
@ -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));
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user