Re: problem with timezone parsing
James Henstridge <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Feb 18, 2009 at 10:04 PM, Karsten Hilbert <[email protected]> wrote: > This reduces the coverage of the new caster to TIMESTAMPTZ. > The drawback, however, is that that OID is now hardcoded > (problems with which will show up early due to the check). > > 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. So when it says "#define TIMESTAMPTZOID 1184" in /usr/include/postgresql/catalog/pg_type.h, you can depend on that being a constant. 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). James.