Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a problem with the apostrophe \'

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
when i make the query

insert into table ('val1','val2',...,'mmm\'mm',...,'valn');
it works good...

but when I type :
insert into table('val1','val2',...,'mmm \' mm',...,'valn');
it doesn't work !!!!!
I don't understand !!
is that a bug or it's me that make a mistake ???
thank you for your help. :)
 
What the version of Postgresql you have,I am asking this because the statements you are working absolutly fine on my POstgresql database on redhat linux 7 and postgresql version 7.0.2.

If you have the version prior to this then it may be the bug.

try using
insert into table('val1',...,'mmm \\' mm',...,'valn');



Rahul Gade
Rahul_g@ip.eth.net
 
In fact, the problem appears only when there is a space caracter on the left of the \ :
insert (......,'fffffff\'pppppp'.....); ->it works
insert (.......,'ffffff\' ppppppp'.....); -> it works
but insert (.......;'ffffffff \'pppppppp'.......); -> it doesn't work !!

besides, the value 'fffffffff 'ppppppp is a foreign key on another table, and when i try the insert command
there is a foreign key error !!

I'm sure that the value exists since i choose it into a HTML formular and when I choose values which don't contains
\' it works perfectly.

My version of postgresql in a recent one
 
why dont u use.....

insert into table_name values('hhhhhh''ssssssssss')

insert into table_name values('hhhhhh ''ssssssssss')


this makes no problem.

rajsundar.r.

 
Also, the problem might not be in PostgreSQL.

What environment are you using to make this query? Is it from the command line, from a programming language such as PHP, or some sort of GUI admin tool?

For example, PHP has a feature which automatically escapes apostrophes, etc... for database insertion. This feature is enabled by default, and maybe it is trying to add an extra slash to escape the slash you already have.

I have also noticed that ODBC sometimes has problems with this. -------------------------------------------

"Calculus is just the meaningless manipulation of higher symbols"
                          -unknown F student
 
ok, thanks for all, there is nearly one year ago, so if i remember good it was my PHP environment which addslashes...thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top