Re: #escape_string_warning = off

From: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Marko Kreen <marko(at)l-t(dot)ee>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Subject: Re: #escape_string_warning = off
Date: 2005-08-02 23:18:27
Message-ID: 42EFFF43.2090503@empires.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dennis Bjorklund wrote:
> On Tue, 2 Aug 2005, Jeff Davis wrote:
>
>
>>>>Does the SQL standard provide no way to have a NULL character in a
>>>>string constant? Is single-quote the only special character?
>>>
>>>I don't think it forbids you from using the null character. It's not like
>>>the strings are zero terminated. Some encodings might not allow the null
>>>character, but that's different.
>>
>>But doesn't PostgreSQL forbid us from using the NULL character in a
>>query at all? Don't we always have to escape or encode it in some way?
>
>
> Pg does not allow \0 in strings at all. Try SELECT 'abc\0def'; in the
> current version of pg.
>
> The sql standard doesn't forbid null values in strings as far as I know
> and that's all I talked about. To have a sql standard string with null
> inside you just insert the 0 byte (for normal single byte encodings), no
> escaping needed.

I guess what I'm trying to find out: does this mean that after all this
change to the way strings are handled in the future, PostgreSQL still
won't be standards-compliant for the basic '' string?

Also, let's say I have apps now in 7.4/8.0, and I want them to be
forward-compatible. Should I make a type called E so that the E''
notation will work, and then use that for strings? What is the "right"
way to do it?

I found a few things in the archives, but I didn't see these particular
things addressed.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2005-08-03 00:51:48 Re: [8.0.3] Not dumping all sequences ...
Previous Message Tom Lane 2005-08-02 22:36:52 Re: [8.0.3] Not dumping all sequences ...