X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 887C2D1B4EB for ; Tue, 16 Sep 2003 13:46:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 07881-01 for ; Tue, 16 Sep 2003 10:46:32 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 1FCF9D1B4EC for ; Tue, 16 Sep 2003 10:46:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8GDkQpr016697; Tue, 16 Sep 2003 09:46:26 -0400 (EDT) To: Alberto Cabello Sanchez Cc: pgsql-interfaces@postgresql.org Subject: Re: ColumnName and ColumnNumber in libpq (C interface) In-reply-to: <20030916075640.GA10965@guadiana.unex.es> References: <3F65715A.BDCAD1FB@rodos.fzk.de> <10317.1063637327@sss.pgh.pa.us> <20030916075640.GA10965@guadiana.unex.es> Comments: In-reply-to Alberto Cabello Sanchez message dated "Tue, 16 Sep 2003 09:56:40 +0200" Date: Tue, 16 Sep 2003 09:46:26 -0400 Message-ID: <16696.1063719986@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/35 X-Sequence-Number: 4453 Alberto Cabello Sanchez 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