Re: ColumnName and ColumnNumber in libpq (C interface)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alberto Cabello Sanchez <alberto(at)unex(dot)es>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: ColumnName and ColumnNumber in libpq (C interface)
Date: 2003-09-16 13:46:26
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Alberto Cabello Sanchez <alberto(at)unex(dot)es> writes:
> On Mon, Sep 15, 2003 at 10:48:47AM -0400, Tom Lane wrote:
>> I wonder whether this behavior is appropriate for PQfnumber, though.
>> It's never been documented ... and certainly should be if we decide
>> we should keep it. Comments?

> I think PQfnumber(res,PQfname(res,0))==-1 should_never_happen (c) with a
> valid PGresult * res.

> Maybe PQfname(res,0) should be "\"Bar\"", not "Bar".

I don't really want to change PQfname; that would probably break more
apps than changing PQfnumber.

We could achieve the property you suggest if we forgot about
case-insensitive matching and dequoting, and simply made PQfnumber check
for an exact match.

Or we could try some combination behavior (say, try exact match, then
if no luck apply the dequote/downcase logic). This might offer better
backwards compatibility, but the more complex the behavior, the more
potential for surprising corner cases ...

regards, tom lane

In response to


Browse pgsql-interfaces by date

  From Date Subject
Next Message Sergio Ramos 2003-09-16 14:58:34 Connection refused. HELP ME!!!!
Previous Message Christoph Haller 2003-09-16 13:12:00 Re: Replicate database