Re: [SQL] quotes etc

2011-02-23 Thread Emi Lu

On 02/22/2011 04:18 PM, Adrian Klaver wrote:

On Tuesday, February 22, 2011 12:26:41 pm John Fabiani wrote:

 > Hi,

 > I would have thought that there would be a simple built-in function that

 > would escape the quotes as ('D' Andes') to ('D\' Andes'). But I did not

 > see anything?

 >

 > I am I wrong?

 >

 > Johnf

Dollar quoting ? :

http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html

4.1.2.4. Dollar-Quoted String Constants

test(5432)aklaver=>SELECT $$D' Andes$$;

?column?

--

D' Andes


I like this $str$$str$ very much!

Vote for this!
--
Lu Ying

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] quotes etc

2011-02-22 Thread Adrian Klaver
On Tuesday, February 22, 2011 12:26:41 pm John Fabiani wrote:
> Hi,
> I would have thought that there would be a simple built-in function that
> would escape the quotes as ('D' Andes')  to ('D\' Andes').  But I did not
> see anything?
> 
> I am I wrong?
> 
> Johnf

Dollar quoting ? :

http://www.postgresql.org/docs/9.0/interactive/sql-syntax-lexical.html
4.1.2.4. Dollar-Quoted String Constants

test(5432)aklaver=>SELECT $$D' Andes$$;
 ?column? 
--
 D' Andes

-- 
Adrian Klaver
adrian.kla...@gmail.com


Re: [SQL] quotes etc

2011-02-22 Thread Kenneth Marshall
On Tue, Feb 22, 2011 at 12:26:41PM -0800, John Fabiani wrote:
> Hi,
> I would have thought that there would be a simple built-in function that 
> would 
> escape the quotes as ('D' Andes')  to ('D\' Andes').  But I did not see 
> anything?
> 
> I am I wrong?
> 
> Johnf
> 

The manual goes over many permutations of the escape process and
what options can be used in each case. I would start there, because
for example, escaping a "'" in SQL uses two "'"s: i.e. 'D' Andes'
becomes 'D'' Andes' I think. Procedural languages and libpq can
offer many other options for escape processing.

Cheers,
Ken

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] quotes etc

2011-02-22 Thread John Fabiani
Hi,
I would have thought that there would be a simple built-in function that would 
escape the quotes as ('D' Andes')  to ('D\' Andes').  But I did not see 
anything?

I am I wrong?

Johnf

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql