Re: Object IDs in Parse message
Dave Cramer <[email protected]> Wed, 4 Sep 2019 05:49:21 -0400
| Newsgroups | gmane.comp.db.postgresql.interfaces |
|---|---|
| Message-ID | <CADK3HHK0A-YFY=3cdtu7VCNc6HVTD69cLE6iw+L4LbPGGmeVog@mail.gmail.com> |
--0000000000003974780591b71fc3 Content-Type: text/plain; charset="UTF-8" On Wed, 4 Sep 2019 at 03:45, Malcolm Matalka <[email protected]> wrote: > > Tom Lane <[email protected]> writes: > > > Malcolm Matalka <[email protected]> writes: > >> Hello, I'm implementing my own pgsql client for fun and I'm trying to > >> understand how to send a Parse message. The final parameter to Parse is > >> a series of Int32s with the description: > >> Specifies the object ID of the parameter data type. Placing a zero here > >> is equivalent to leaving the type unspecified. > > > >> But where do I find the list of object IDs? > > > > SELECT oid, typname FROM pg_type; > > > >> If so, It's not clear how to express some things. For example there is > >> a MONEYARRAYOID, but no MONEYOID. > > > > For historical reasons, the macro for money's OID is CASHOID. > > There's no grandfathered symbol for money[], though, so that > > gets a name constructed per standard rules (cf form_pg_type_symbol > > in genbki.pl). > > > > However, I fail to see why a generic client would need to know that. > > If you're hard-wiring OIDs into your code for anything beyond very > > basic types like int4, you're probably doing it wrong. Remember > > Ok, it wasn't clear to me if and when I should pass this data in. I > couldn't find any documentation for this translating to performance > improvement, or addressing any possible errors due to ambiguity in > types. In general, should an interface no pass that information in on a > Parse? Is there a reason to do it? > Yes, if you ever decide to use binary mode for the parameters and the results then you need to know the type The jdbc driver and the .net driver both do this. Dave --0000000000003974780591b71fc3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Wed, 4 Sep 2019 at 03:45, Malcolm = Matalka <<a href=3D"mailto:[email protected]">[email protected]</a>>= ; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px= 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br> Tom Lane <<a href=3D"mailto:[email protected]" target=3D"_blank">tgl@sss= .pgh.pa.us</a>> writes:<br> <br> > Malcolm Matalka <<a href=3D"mailto:[email protected]" target=3D"_b= lank">[email protected]</a>> writes:<br> >> Hello, I'm implementing my own pgsql client for fun and I'= m trying to<br> >> understand how to send a Parse message.=C2=A0 The final parameter = to Parse is<br> >> a series of Int32s with the description:<br> >> Specifies the object ID of the parameter data type. Placing a zero= here<br> >> is equivalent to leaving the type unspecified.<br> ><br> >> But where do I find the list of object IDs?<br> ><br> > SELECT oid, typname FROM pg_type;<br> ><br> >> If so, It's not clear how to express some things.=C2=A0 For ex= ample there is<br> >> a MONEYARRAYOID, but no MONEYOID.<br> ><br> > For historical reasons, the macro for money's OID is CASHOID.<br> > There's no grandfathered symbol for money[], though, so that<br> > gets a name constructed per standard rules (cf form_pg_type_symbol<br> > in <a href=3D"http://genbki.pl" rel=3D"noreferrer" target=3D"_blank">g= enbki.pl</a>).<br> ><br> > However, I fail to see why a generic client would need to know that.<b= r> > If you're hard-wiring OIDs into your code for anything beyond very= <br> > basic types like int4, you're probably doing it wrong.=C2=A0 Remem= ber<br> <br> Ok, it wasn't clear to me if and when I should pass this data in.=C2=A0= I<br> couldn't find any documentation for this translating to performance<br> improvement, or addressing any possible errors due to ambiguity in<br> types.=C2=A0 In general, should an interface no pass that information in on= a<br> Parse?=C2=A0 Is there a reason to do it?<br></blockquote><div><br></div><di= v>Yes, if you ever decide to use binary mode for the parameters and the res= ults then you need to know the type</div><div>The jdbc driver and the .net = driver both do this.</div><div><br></div><div>Dave</div></div></div> --0000000000003974780591b71fc3--