Re: RowDescription for a function does not include table OID

2024-06-21 Thread Tom Lane
"David G. Johnston" writes: > On Fri, Jun 21, 2024 at 8:51 AM Tom Lane wrote: >> The PG wire protocol specification [1] defines these fields thus: >> If the field can be identified as a column of a specific >> table, the object ID of the table; otherwise zero. > s/can be identified as/

Re: RowDescription for a function does not include table OID

2024-06-21 Thread Tom Lane
"David G. Johnston" writes: > Based upon that unargued point the only bug here is in the documentation, > leaving the reader to assume that some effort will be made to chain > together a function returns clause to a physical table through that table's > automatically-generated composite type. Hmm

Re: RowDescription for a function does not include table OID

2024-06-21 Thread David G. Johnston
On Fri, Jun 21, 2024 at 8:51 AM Tom Lane wrote: > > The PG wire protocol specification [1] defines these fields thus: > > If the field can be identified as a column of a specific > table, the object ID of the table; otherwise zero. > > If the field can be identified as a c

Re: RowDescription for a function does not include table OID

2024-06-21 Thread David G. Johnston
On Fri, Jun 21, 2024 at 8:41 AM Maxwell Dreytser < maxwell.dreyt...@assistek.com> wrote: > On Friday, June 21, 2024 11:28 AM David G. Johnston < > david.g.johns...@gmail.com> wrote: > > > In short, the system doesn't generate the information you need, where > you need it, to tie these pieces toget

Re: RowDescription for a function does not include table OID

2024-06-21 Thread Tom Lane
Maxwell Dreytser writes: > I am working on a meta-programming use-case where I need to scrape some > detailed information about the results of a function that "RETURNS TABLE > (LIKE physical_table)", which ends up with prorettype = > 'physical_table'::regtype. > The problem is that for the quer

Re: RowDescription for a function does not include table OID

2024-06-21 Thread Maxwell Dreytser
On Friday, June 21, 2024 11:28 AM David G. Johnston wrote: > Interesting, then I suppose it is semantics.  There is no table involved - > you are referencing the type of that name, not the table - so no TableOID.  > There is no guarantee the row you are holding came from a table - and I'd > i

Re: RowDescription for a function does not include table OID

2024-06-21 Thread David G. Johnston
On Fri, Jun 21, 2024 at 8:04 AM Maxwell Dreytser < maxwell.dreyt...@assistek.com> wrote: > On Friday, June 21, 2024 10:48 AM David G. Johnston < > david.g.johns...@gmail.com>wrote: > > >Yes, but the bug is yours. The definition you want is: RETURNS SETOF > physical_table (not tested though) > >W

Re: RowDescription for a function does not include table OID

2024-06-21 Thread Maxwell Dreytser
On Friday, June 21, 2024 10:48 AM David G. Johnston wrote: >Yes, but the bug is yours.  The definition you want is:  RETURNS SETOF >physical_table (not tested though) >What you did was produce a one-column table whose column type is a composite >(and whose name is like - what with case-folding

Re: RowDescription for a function does not include table OID

2024-06-21 Thread David G. Johnston
On Fri, Jun 21, 2024 at 7:42 AM Maxwell Dreytser < maxwell.dreyt...@assistek.com> wrote: > I am working on a meta-programming use-case where I need to scrape some > detailed information about the results of a function that "RETURNS TABLE > (LIKE physical_table)" > Yes, but the bug is yours. The