Skip site navigation (1) Skip section navigation (2)

Re: Portable interfaces ...

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Preston A(dot) Elder" <prez(at)neuromancy(dot)net>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Portable interfaces ...
Date: 2004-03-26 10:22:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Preston A. Elder wrote:
> Does postgres have an API review team or anything?


> I mean, not trying to offend anyone here, but I don't see how any API
> where you cannot find out details about a table and its columns (such
> as character encoding schemes in effect, data type for the column
> (even if only for pre-defined data types), field lengths (for
> strings/etc), etc) could be considered anything but deficient.

> Add to this the "support" for unicode - I mean, its almost like it
> was added as an afterthought,


> since the API won't help you, without
> using non-portable facilities (ie. headers/etc that may or may not
> exist on a system).

I don't understand what the API has to do with Unicode.  Either your 
strings are in Unicode or they are not.  This is set by your 

> For now, I am (grudgingly) copying the OID codes, and going to use
> system-based multibyte/unicode functions (and hope to heck that they
> are compatible with postgres, but I get the feeling they are not
> fully compatible after browsing pg_wchar.h)

They should be.

> is, right now, I have no verification on things like string lengths
> because theres no real way to find out the maximum length of a field
> (encoding-specific - ie. for UTF-8, a length of 20 means 20 chars,
> for UTF-16, a length of 20 means 20 wchar_t's (40 bytes)).

The libpq API gives you a way to determine the binary length of a 
returned datum.  You need to allocate that dynamically.

> What are the plans for the Postgres API - as I said, I
> find it hard to believe I am the first to raise this issue, so are
> there plans to have function calls to retrieve 'column properties'
> and the like?

The plans are more or less that if you don't like it, try using a 
different one, such as ODBC, or if a different programming language 
than C.

In response to


pgsql-interfaces by date

Next:From: J├╝rgen CappelDate: 2004-03-26 12:26:28
Subject: ECPG segfault
Previous:From: Peter EisentrautDate: 2004-03-26 10:16:14
Subject: Re: Portable interfaces ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group