Re: problem with timezone parsing

Karsten Hilbert <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Wed, Feb 18, 2009 at 11:28:34PM +0900, James Henstridge wrote:

> > Frederico said, that using DATETIME.values is safe because
> > the OIDs are taken from my PostgreSQL headers. But what
> > happens if locally I have PG 8.1 installed while the remote
> > server runs PG 8.3 (and assuming the OIDs happen to not be
> > identical) ?
> 
> The OID values for these built in types are fixed.  If they could
> change from installation to installation or version to version, then
> it would not be safe to include the values in a header file.
That makes sense.

> So when it says "#define TIMESTAMPTZOID  1184" in
> /usr/include/postgresql/catalog/pg_type.h, you can depend on that
> being a constant.
Good. Sometimes I'm a bit paranoid as my users (and me) deal
with patient data.

> Of course, if you're writing a typecaster for a user defined type, you
> should check the catalogue for the oid value (which also means the
> caster should be registered at connection level rather than globally).
I understand. It's just that the examples explicitely
checked for the text type OIDs.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.