PQftype(copy_rset) returns zero OIDs???

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: PQftype(copy_rset) returns zero OIDs???
Date: 2024-02-27 12:12:45
Message-ID: CAFCRh-8BMj86X6DfpfQuV3NnTaH4eU+4=-MAwyhVKT98EThFMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

For the first time, I'm checking the OIDs returned
(via the result set's PQftype API), by "regular" SELECT:

`select ... from tab`

and by a COPY TO BINARY:

`COPY (
select ...
from tab
) TO STDOUT WITH (FORMAT BINARY)`

And to my surprise, they are not!
The ones from the COPY are all zeros.

Is that normal?

The BINARY record format encodes the byte-size, not the OIDs of the
(scalar) fields.
How is one supposed to "infer" the OIDs then?

Also, given that the select-clause can use expressions I think,
including casts, instead of just naming columns, "describing" the table
doesn't help.

But even for a "plain" COPY, having to describe explicitly is one more
round-trip,
and seems asymmetrical compared to the result-set of a regular select.

I'm both surprised and confused by this behavior.
And would appreciate some clarifications. Thanks, --DD

PS: libpq v16.1. v12 server.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-02-27 14:09:20 Re: PostgreSQL Guard
Previous Message David Rowley 2024-02-27 11:34:06 Re: Behavior of debug_parallel_query=regress