regarding the apostrophe character

Started by surabhi.ahujaover 20 years ago6 messagesgeneral
Jump to latest
#1surabhi.ahuja
surabhi.ahuja@iiitb.ac.in

hello everyone,

in case i need to give a value which has apostrophe as one of the characters i need to escape it.
and similary for the characters such as backslash.

what other characters need to be escaped. Is there any list published?

cant this be fixed in postgres?

thanks
regards
Surabhi

#2Michael Glaesemann
grzm@seespotcode.net
In reply to: surabhi.ahuja (#1)
Re: regarding the apostrophe character

On Nov 25, 2005, at 13:12 , surabhi.ahuja wrote:

in case i need to give a value which has apostrophe as one of the
characters i need to escape it.
and similary for the characters such as backslash.

http://www.postgresql.org/docs/current/interactive/sql-
syntax.html#SQL-SYNTAX-STRINGS

Michael Glaesemann
grzm myrealbox com

#3surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: Michael Glaesemann (#2)
Re: regarding the apostrophe character

in which version will the use of "Escape string syntax " be supported ..

thanks,
regards

________________________________

From: Michael Glaesemann [mailto:grzm@myrealbox.com]
Sent: Fri 11/25/2005 9:50 AM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] regarding the apostrophe character

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

On Nov 25, 2005, at 13:12 , surabhi.ahuja wrote:

in case i need to give a value which has apostrophe as one of the
characters i need to escape it.
and similary for the characters such as backslash.

http://www.postgresql.org/docs/current/interactive/sql-
syntax.html#SQL-SYNTAX-STRINGS

Michael Glaesemann
grzm myrealbox com

#4Michael Glaesemann
grzm@seespotcode.net
In reply to: surabhi.ahuja (#3)
Re: regarding the apostrophe character

On Nov 25, 2005, at 13:40 , surabhi.ahuja wrote:

in which version will the use of "Escape string syntax " be
supported ..

I know they work in 8.1. You can check the release notes:

http://www.postgresql.org/docs/current/interactive/release.html

The SQL standard way of escaping single-quotes is ''.

test=# select version();

version
------------------------------------------------------------------------
----------------------------------------------------------------------
PostgreSQL 8.1.0 on powerpc-apple-darwin8.3.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc.
build 5026)
(1 row)

test=# select 'foo''s bar' as sql_standard
test-# , e'foo\'s bar' as e_escape
test-# , $$foo's bar$$ as dollar_quote;
sql_standard | e_escape | dollar_quote
--------------+-----------+--------------
foo's bar | foo's bar | foo's bar
(1 row)

Michael Glaesemann
grzm myrealbox com

#5surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: Michael Glaesemann (#4)
Re: regarding the apostrophe character

and what about the backslash character ...

do we need to escape it as well? or it is treated as a normal character

________________________________

From: Michael Glaesemann [mailto:grzm@myrealbox.com]
Sent: Fri 11/25/2005 4:17 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] regarding the apostrophe character

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

On Nov 25, 2005, at 13:40 , surabhi.ahuja wrote:

in which version will the use of "Escape string syntax " be
supported ..

I know they work in 8.1. You can check the release notes:

http://www.postgresql.org/docs/current/interactive/release.html

The SQL standard way of escaping single-quotes is ''.

test=# select version();

version
------------------------------------------------------------------------
----------------------------------------------------------------------
PostgreSQL 8.1.0 on powerpc-apple-darwin8.3.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc.
build 5026)
(1 row)

test=# select 'foo''s bar' as sql_standard
test-# , e'foo\'s bar' as e_escape
test-# , $$foo's bar$$ as dollar_quote;
sql_standard | e_escape | dollar_quote
--------------+-----------+--------------
foo's bar | foo's bar | foo's bar
(1 row)

Michael Glaesemann
grzm myrealbox com

#6Michael Glaesemann
grzm@seespotcode.net
In reply to: surabhi.ahuja (#5)
Re: regarding the apostrophe character

On Nov 28, 2005, at 21:20 , surabhi.ahuja wrote:

and what about the backslash character ...

do we need to escape it as well? or it is treated as a normal
character

What have you tried? What do the docs say?

Michael Glaesemann
grzm myrealbox com