X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C0368D1B4FC for ; Sun, 5 Oct 2003 17:59:11 +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 70750-10 for ; Sun, 5 Oct 2003 14:58:26 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 36F99D1B4ED for ; Sun, 5 Oct 2003 14:58:24 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h95HwL212741; Sun, 5 Oct 2003 13:58:21 -0400 (EDT) From: Bruce Momjian Message-Id: <200310051758.h95HwL212741@candle.pha.pa.us> Subject: Re: PQfnumber and quoted identifiers In-Reply-To: To: Peter Eisentraut Date: Sun, 5 Oct 2003 13:58:21 -0400 (EDT) Cc: PostgreSQL Development X-Mailer: ELM [version 2.4ME+ PL106 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/252 X-Sequence-Number: 44934 Peter Eisentraut wrote: > There was a discussion on -interfaces that might need more consideration. > > http://archives.postgresql.org/pgsql-interfaces/2003-09/msg00026.php > > > Apparently, it has so far been an undocumented feature of libpq's function > PGfnumber (return column number from column name) that the column name > needs to be double-quoted if it contains upper-case letters. That, is you > need to write > > PQfnumber(res, "\"Bar\"") > > I think this is completely bizarre and pointless. This is a C interface > and not SQL. Other libpq functions that accept names of SQL objects don't > do this. Also, PQfname and PQfnumber ought to be inverses. > > Since this behavior was undocumented and no one had noticed it in the last > 10 years, I think we can away with removing it. I agree. I would never expect to add quotes to a C string to preserve case (outside SQL), and the fact that PQfname doesn't return the string in quotes is another inconsistency. It is sort of like case coming out is significant, but case going in has to be quoted --- am I getting this right? Do we do this in other areas? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073