Thread

Commits

  1. Make argument names of pg_get_object_address consistent, and fix docs.

  1. Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Jean-Pierre Pelletier <jean.pierre.pelletier0@gmail.com> — 2018-09-03T15:07:35Z

    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".
    
    This query shows what the function returns:
    select (pg_identify_object_as_address(classId, ObjId, objSubId)).*
    from  pg_depend where classId <> 0;
    
    Thanks,
    Jean-Pierre Pelletier
    
    
    
  2. Re: Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-09-03T18:36:31Z

    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.
    
    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.
    
    			regards, tom lane
    
    
    
  3. Re: Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Andrew Gierth <andrew@tao11.riddles.org.uk> — 2018-09-03T18:51:21Z

    >>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
    
     Tom> I do not think we can change the names of the output arguments;
     Tom> it'd break existing queries. However, renaming input arguments
     Tom> shouldn't affect anything.
    
    What about callers that might be using named-argument notation?
    
    -- 
    Andrew (irc:RhodiumToad)
    
    
    
  4. Re: Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-09-03T18:54:13Z

    Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
    > "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
    >  Tom> I do not think we can change the names of the output arguments;
    >  Tom> it'd break existing queries. However, renaming input arguments
    >  Tom> shouldn't affect anything.
    
    > What about callers that might be using named-argument notation?
    
    Oh ... hmm, that could be a problem.  But do you think anybody's
    likely to be using that for pg_get_object_address?
    
    			regards, tom lane
    
    
    
  5. Re: Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2018-09-03T18:56:14Z

    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
    
    
    
  6. Re: Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-09-05T15:49:36Z

    Alvaro Herrera <alvherre@2ndquadrant.com> writes:
    > On 2018-Sep-03, Tom Lane wrote:
    >> 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:
    
    Yeah, Andrew noted the same ...
    
    > 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.
    
    ... and that's pretty much my feeling.  It seems really unlikely that
    anyone's using named-argument notation for pg_get_object_address, and
    even if they are, it wouldn't be very painful to change, or just not
    use the notation if they need cross-branch compatibility.  I think it's
    more useful in the long run to make the names consistent.
    
    Will go take care of it.
    
    			regards, tom lane
    
    
    
  7. Re: Out arguments name of "pg_identify_object_as_address" function in 9.5.14 and 11beta3

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2018-09-05T15:57:11Z

    On 2018-Sep-05, Tom Lane wrote:
    
    > Alvaro Herrera <alvherre@2ndquadrant.com> writes:
    
    > > 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.
    > 
    > ... and that's pretty much my feeling.  It seems really unlikely that
    > anyone's using named-argument notation for pg_get_object_address, and
    > even if they are, it wouldn't be very painful to change, or just not
    > use the notation if they need cross-branch compatibility.  I think it's
    > more useful in the long run to make the names consistent.
    > 
    > Will go take care of it.
    
    Agreed, thanks.  If you haven't touched the docs yet, here's the change
    -- 9.5/9.6/10 need a slight adjustment from 11/master.
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services