pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
c type of int8 / serial8?
4+ messages / 2 participants
[nested] [flat]

* c type of int8 / serial8?
@ 2008-08-10 17:11  Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
  0 siblings, 1 reply; 4+ messages in thread

From: Joost Kraaijeveld @ 2008-08-10 17:11 UTC (permalink / raw)
  To: pgsql-odbc

Hi,

I wonder what the C type of int8 / serial8 is.

If I use SQLGetTypeInfo() to get all the supported type is says that
int8 is of SQL type SQL_BIGINT. It does not show any values for serial8
but I suppose that that is a user defined type and the driver is not
required to show those (is that correct?). 

If I use SQLColumns() and get the data type from that function, is says
for both int8 and serial8 that the SQL type is SQL_BIGINT. There is
however not mapping for SQL_BIGINT to a C type. There is a mapping to a
signed or unsigned 8 byte integer (SQL_C_SBIGINT or SQL_C_UBIGINT).

From the docs
(http://www.postgresql.org/docs/8.3/interactive/datatype.html , table
8.1)  I see that int8 is a "signed eight-byte integer". For serial8 it
only says "autoincrementing eight-byte integer". So I assume that int8
is actually SQL_C_SBIGINT, but I am unsure about serial8: is it signed
or unsigned?

Shouldn't both SQLGetTypeInfo and SQLColumns return SQL_C_SBIGINT for
int8, and/or return SQL_C_SBIGINT/SQL_C_UBIGINT for serial8,. depending
on the signed-ness?

TIA

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: c type of int8 / serial8?
@ 2008-08-12 02:50  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
  0 siblings, 1 reply; 4+ messages in thread

From: Hiroshi Inoue @ 2008-08-12 02:50 UTC (permalink / raw)
  To: J.Kraaijeveld@Askesis.nl; +Cc: pgsql-odbc

Joost Kraaijeveld wrote:
> Hi,
> 
> I wonder what the C type of int8 / serial8 is.
> 
> If I use SQLGetTypeInfo() to get all the supported type is says that
> int8 is of SQL type SQL_BIGINT. It does not show any values for serial8
> but I suppose that that is a user defined type and the driver is not
> required to show those (is that correct?). 

No.
serial8 is bigint not a user defined type.

xxxx=> create table tab1 (id serial8);
NOTICE:  CREATE TABLE will create implicit sequence "tab1_id_seq" for 
serial column "tab1.id"
CREATE TABLE
xxxx=> insert into tab1 values ('-9223372036854775808');
INSERT 0 1
xxxx=> select * from tab1;
           id
----------------------
  -9223372036854775808
(1 row)




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: c type of int8 / serial8?
@ 2008-08-12 04:24  Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
  parent: Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 4+ messages in thread

From: Joost Kraaijeveld @ 2008-08-12 04:24 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc

On Tue, 2008-08-12 at 11:50 +0900, Hiroshi Inoue wrote:
> Joost Kraaijeveld wrote:
> > Hi,
> > 
> > I wonder what the C type of int8 / serial8 is.
> > 
> > If I use SQLGetTypeInfo() to get all the supported type is says that
> > int8 is of SQL type SQL_BIGINT. It does not show any values for serial8
> > but I suppose that that is a user defined type and the driver is not
> > required to show those (is that correct?). 
> 
> No.
> serial8 is bigint not a user defined type.

In that case : why doesn't SQLGetTypeInfo return serial8 (and serial) as
a supported type?

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: c type of int8 / serial8?
@ 2008-08-12 05:30  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
  0 siblings, 0 replies; 4+ messages in thread

From: Hiroshi Inoue @ 2008-08-12 05:30 UTC (permalink / raw)
  To: J.Kraaijeveld@Askesis.nl; +Cc: pgsql-odbc

Joost Kraaijeveld wrote:
> On Tue, 2008-08-12 at 11:50 +0900, Hiroshi Inoue wrote:
>> Joost Kraaijeveld wrote:
>>> Hi,
>>>
>>> I wonder what the C type of int8 / serial8 is.
>>>
>>> If I use SQLGetTypeInfo() to get all the supported type is says that
>>> int8 is of SQL type SQL_BIGINT. It does not show any values for serial8
>>> but I suppose that that is a user defined type and the driver is not
>>> required to show those (is that correct?). 
>> No.
>> serial8 is bigint not a user defined type.
> 
> In that case : why doesn't SQLGetTypeInfo return serial8 (and serial) as
> a supported type?

I'm not sure if the driver should report serial(8) as a suppooted type.
They both are kind of macro and don't exist in pg_type.

regards,
Hiroshi Inoue




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2008-08-12 05:30 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-08-10 17:11 c type of int8 / serial8? Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
2008-08-12 02:50 ` Hiroshi Inoue <inoue@tpf.co.jp>
2008-08-12 04:24   ` Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
2008-08-12 05:30     ` Hiroshi Inoue <inoue@tpf.co.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox