On Wed, Aug 13, 2003 at 01:33:46PM -0700, Doug Silver wrote:
> Hi Tim -
>
> Upon further RTFM (sigh, should have known better!), the DBD::Pg docs reveal
> the following:
> TYPE (array-ref, read-only)
> Supported by the driver as proposed by DBI, with the restriction,
> that the types are PostgreSQL specific data-types which do not
> correspond to international standards.
That's plain wrong. DBD::Pg is broken in that regard.
> I've written a simple subroutine that does inserts and updates based on a
> hash, so what I did was to query the table in question and get the
> appropriate types for the fields and adjust the quotes/etc based on the type.
> I'm not expecting to migrate to a different db anytime soon, so it's not that
> important to use the ISO/ANSI standards vs Postgresql's values. However I
> guess it's probably best to completely use the native {pg_type} for now
> unless you have some advice for an alternative route.
Use the native {pg_type} as {TYPE} will get fixed at some point... I hope.
Are any DBD::Pg developers listening?
Tim.
> Thanks.
>
> -doug
>
> On Wednesday 13 August 2003 06:03 am, Tim Bunce wrote:
> > On Wed, Aug 13, 2003 at 11:21:55AM +0100, Tim Bunce wrote:
> > > The $sth->{TYPE} attribute should return ISO/ANSI standard type values.
> > > The $sth->{pg_type} (or similar) attribute should return native Postgesql
> > > type values.
> >
> > I should add that drivers can map native types that have no ISO/ANSI
> > standard equivalent type into the numeric range reserved for the DBI
> > (-9999 to -9000) and return that in $sth->{TYPE}->[$index].
> >
> > The key point is that the values in $sth->{TYPE} *must* be
> > *standard* ISO/ANSI/(ODBC) type values and not native ones.
> > So if DBD::Pg is returning 1184 for timestamp, for example,
> > that's a bug.
> >
> > See also the docs for the type_info_all and type_info methods, and
> > the TYPE attribute.
> >
> > Tim.
> >
> > > Tim.
> > >
> > > On Tue, Aug 12, 2003 at 02:59:37PM -0700, Doug Silver wrote:
> > > > Hi All -
> > > >
> > > > I'm trying to get a mapping of the values that the DBI uses when
> > > > returning the TYPE information for a table. I'm using the following:
> > > >
> > > > Postgresql 7.3.2
> > > > DBD-Pg 1.21
> > > > DBI 1.34_1
> > > > FreeBSD 4.8
> > > >
> > > > It seems that the internal Postgresql values are not matching up with
> > > > what the DBI/DBD::Pg returns, e.g.
> > > >
> > > > Field type Postgresql type DBI TYPE
> > > > integer (int2) 21 5
> > > > integer (int4) 23 4
> > > > integer (int8) 20 8
> > > > varchar 1043 12
> > > > timestamp 1184 1184 (ok)
> > > > text 25 25 (ok)
> > > > date 1082 9
> > > >
> > > > Any suggestions how to find the complete list for the DBI data types?
> > > >
> > > > TIA.
> > > >
> > > > -Doug
>