Re: OID of type by name.

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: tahoe-gary <gbaker(at)salesforce(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: OID of type by name.
Date: 2013-04-05 08:45:10
Message-ID: CAAfz9KODq5MpQSTLcdcvdkAE0PU117myHqDRgWayrhkpfqK7fQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/3/29 tahoe-gary <gbaker(at)salesforce(dot)com>

> In what version of PG is the 'my_type'::regtype::oid syntax available? I
> want to introduce this to the JDBC driver which currently does the most
> ridiculous query that totally ignores search path.
>
> JDBC driver does this currently: SELECT oid FROM pg_catalog.pg_type WHERE
> typname = ?
>
> So if you have more than one type of the same name (or perhaps a UDT and a
> table with the same name as in my case) it just grabs whichever one first
> appears in pg_type regardless of search path.
>
> So I intend to change that query to: SELECT ?::regtype::oid
>
> But I need to know if I should be checking the server version or not. What
> is the min version that that query will work on?
>
According to the documentation, I think that Object Identifier Types was
introduced in 7.3.
http://www.postgresql.org/docs/7.3/static/datatype-oid.html

--
// Dmitriy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Condor 2013-04-05 09:54:14 Re: Need advice to avoid ORDER BY
Previous Message Michael Paquier 2013-04-05 07:31:31 Re: Oracle to PostgreSQL transition?