Re: escape string type for upcoming 8.1 - Mailing list pgsql-general

From Jeff Davis
Subject Re: escape string type for upcoming 8.1
Date
Msg-id 42FAE582.4080508@empires.org
Whole thread Raw
In response to Re: escape string type for upcoming 8.1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Having said that, though, I'm agin back-porting this.  We don't
> back-patch feature additions, and this can hardly be described as
> a bug fix.
>

I'm not for or against back porting this feature. I basically want to
know if my plan (appended to this email) was a sane way to write
forward-compatible code.

I can't rely on PQescapeString, because the client library may be a
different version than the server. Right?

The only other logical option is to make a wrapper function around two
string-escaping functions that checks the server version and creates a
string accordingly.

Regards,
    Jeff Davis

PS: my plan for making an E'' like string in 8.0:

CREATE FUNCTION ein(CSTRING) RETURNS E AS 'textin' LANGUAGE internal;

CREATE FUNCTION eout(E) RETURNS CSTRING AS 'textout' LANGUAGE internal;

CREATE TYPE E (input=ein,output=eout);

CREATE CAST (E AS TEXT) WITHOUT FUNCTION AS IMPLICIT;

CREATE CAST (TEXT AS E) WITHOUT FUNCTION AS IMPLICIT;

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: EnterpriseDB mentioned in eweek, and...
Next
From: Jeff Davis
Date:
Subject: Re: Change to PostgreSQL