Re: RowDescription for a function does not include table OID - Mailing list pgsql-interfaces

From Maxwell Dreytser
Subject Re: RowDescription for a function does not include table OID
Date
Msg-id LV3PR16MB6001216CE02B2D908F9D87ECE6C82@LV3PR16MB6001.namprd16.prod.outlook.com
Whole thread Raw
In response to Re: RowDescription for a function does not include table OID  (Maxwell Dreytser <Maxwell.Dreytser@assistek.com>)
List pgsql-interfaces
From: Tom Lane <tgl@sss.pgh.pa.us>:

>Hmm, I do not think that syntax means what you think it means ;-).

Its an interesting trick that I came across on DBA SE on a question named "How to use RETURNS TABLE with an existing
tablein PostgreSQL?". 

>However, it seems to end up with prorettype =
>physical_table'::regtype anyway thanks to some special rules about
>single-column output tables, so as far as I can see you should get
>the table's composite type OID as the column type OID in the result
>descriptor for "SELECT my_function(...)".  Or is that not the case
>you're concerned about?

The query I am running is "SELECT * FROM my_function()". According to Wireshark I can see that the returned
RowDescriptionshows 0 for Table OID and Column index: 

PostgreSQL
    Type: Row description
    Length: 219
    Field count: 7
        Column name: table_id
            Table OID: 0
            Column index: 0
            Type OID: 20
            Column length: 8
            Type modifier: -1
            Format: Binary (1)
<snipped>

>I'm confused about exactly what you're asking for, but (a) returning a
>type OID where a relation OID is expected is absolutely not OK ---
>there is no guarantee that those OID sets are distinct; (b) regardless
>of that, you seem to be asking for a silent semantic change in the
>wire protocol, which is going to be a very hard sell because it will
>probably break more applications than it makes happy.  Why can't you
>get what you need from the composite type OID?

I would like the relation OID to be returned for the composite type that is returned from the function.

Maybe this can be simply considered a bug as it does seem like returning the relation OID that is clearly available
wouldbe the expected behavior. 

Regards,
Maxwell.


pgsql-interfaces by date:

Previous
From: Maxwell Dreytser
Date:
Subject: Re: RowDescription for a function does not include table OID