Thread: PQprepare case sensitive?

PQprepare case sensitive?

From
Michael Meskes
Date:
I haven't looked into the sources yet, but PQprepare's behaviour in my
new ecpglib code suggests that the statement name is case sensitive. Is
this by design? I wonder because a statement like this cannot be
deallocated afterwards since the parser is case insensitive with regard
to statement names.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: PQprepare case sensitive?

From
Tom Lane
Date:
Michael Meskes <meskes@postgresql.org> writes:
> I haven't looked into the sources yet, but PQprepare's behaviour in my
> new ecpglib code suggests that the statement name is case sensitive. Is
> this by design?

Yes, it's assumed that any quoting/dequoting has already happened by the
time the name gets into the protocol message.

> I wonder because a statement like this cannot be
> deallocated afterwards since the parser is case insensitive with regard
> to statement names.

Sure it can --- use quotes.
        regards, tom lane


Re: PQprepare case sensitive?

From
Michael Meskes
Date:
On Fri, Jun 08, 2007 at 09:56:42AM -0400, Tom Lane wrote:
> Yes, it's assumed that any quoting/dequoting has already happened by the
> time the name gets into the protocol message.

But shouldn't this be documented? I failed to find it. But then this
wouldn't be the first time I fail to find the right place in
documentation.

> > I wonder because a statement like this cannot be
> > deallocated afterwards since the parser is case insensitive with regard
> > to statement names.
> 
> Sure it can --- use quotes.

True of course. My wording was bad. I meant with the same way of writing
the name. 

Again, I have no problem with this behaviour I just wanted to make sure
it's supposed to be this way before I start implementing ecpg's handling
of this.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: PQprepare case sensitive?

From
Tom Lane
Date:
Michael Meskes <meskes@postgresql.org> writes:
> On Fri, Jun 08, 2007 at 09:56:42AM -0400, Tom Lane wrote:
>> Yes, it's assumed that any quoting/dequoting has already happened by the
>> time the name gets into the protocol message.

> But shouldn't this be documented? I failed to find it. But then this
> wouldn't be the first time I fail to find the right place in
> documentation.

Well, the point is that downcasing and quote-stripping are things that
happen in the context of parsing names within SQL statements.  We don't
do that for other names that are sent by themselves in the protocol,
such as user and database names in the startup message.  So I would not
expect it to happen for statement names either.
        regards, tom lane


Re: PQprepare case sensitive?

From
Michael Meskes
Date:
On Fri, Jun 08, 2007 at 11:05:28AM -0400, Tom Lane wrote:
> Well, the point is that downcasing and quote-stripping are things that
> happen in the context of parsing names within SQL statements.  We don't
> do that for other names that are sent by themselves in the protocol,
> such as user and database names in the startup message.  So I would not
> expect it to happen for statement names either.

Valid point. However, I had the statement name in a variable and used it
for prepare and deallocate. It just happened that it had upper case
letters and things didn't work. :-)

Anyway, I fix my code.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!