On 2018-Sep-03, Tom Lane wrote:
> Jean-Pierre Pelletier <jean.pierre.pelletier0@gmail.com> writes:
> > Two of the out arguments name of function
> > "pg_identify_object_as_address" are not as documented.
> > Documentation says "name" and "args", but function returns
> > "object_names" and "object_args".
>
> Hm, yeah. The documentation of pg_get_object_address() seems
> equally divorced from reality. What's more, while pg_get_object_address
> and pg_identify_object_as_address agree on the naming of the
> internal-representation arguments (classid,objid,objsubid),
> they don't agree on the naming of the other arguments
> (type,name,args vs. type,object_names,object_args). Somebody
> was being pretty inconsistent there.
That would have been me. I think I changed opinion in the middle of
that development and forgot to revisit the parts I had already
committed.
> I do not think we can change the names of the output arguments;
> it'd break existing queries. However, renaming input arguments
> shouldn't affect anything. So I propose we make pg_get_object_address'
> input arguments be named type,object_names,object_args for
> consistency with the other function, and update the docs to match.
Hmm, I don't think it's possible to rename input args without breaking
working code either:
alvherre=# select * from pg_get_object_address(args := '{}', type := 'table', name := '{pg_class}');
classid │ objid │ objsubid
─────────┼───────┼──────────
1259 │ 1259 │ 0
(1 fila)
alvherre=# select * from pg_get_object_address('table', '{pg_class}', '{}');
classid │ objid │ objsubid
─────────┼───────┼──────────
1259 │ 1259 │ 0
(1 fila)
That said, I haven't heard of anyone using these functions in code yet,
so if we change it in 11 or 12 nobody is going to complain. (This code
was written to support adding tests for the feature, which in turn was
written to support DDL replication in BDR; that works, but it uses the C
interface rather than SQL, so it wouldn't be affected.)
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services