\'s in ZSQL methods with Postgresql
This: update tb1 set cl1=<dtml-sqlvar val1 type=nb>,who=<dtml-sqlvar "REQUEST.AUTHENTICATED_USER">,time=now() Called with: sqlmethod(val1='\') Fails with: Error Type: ProgrammingError Error Value: ERROR: parser: parse error at or near "loginname" update tb1 set cl1='\',who='loginname',time=now() Clearly the \ needs to be escaped. Is this Postgres specific? If so, why isn't the DA (ZPsycopg) quoting it? Running Zope 2.3.2 Regards, Phil +----------------------------------+ | Phil Mayers, Network Support | | Centre for Computing Services | | Imperial College | +----------------------------------+
"Mayers, Philip J" wrote:
This:
update tb1 set cl1=<dtml-sqlvar val1 type=nb>,who=<dtml-sqlvar "REQUEST.AUTHENTICATED_USER">,time=now()
Called with:
sqlmethod(val1='\')
Fails with:
Error Type: ProgrammingError Error Value: ERROR: parser: parse error at or near "loginname" update tb1 set cl1='\',who='loginname',time=now()
Clearly the \ needs to be escaped. Is this Postgres specific? If so, why isn't the DA (ZPsycopg) quoting it? Running Zope 2.3.2
Regards, Phil
Yes, the error is coming from postgres. In theory the sqlvar tag should be dealing with this (it should be escaping '\' as '\\'). My hunch is that it is a bug in the DA so it is not telling sqlvar how to properly quote it. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Scavenging the mail folder uncovered Mayers, Philip J's letter:
This:
update tb1 set cl1=<dtml-sqlvar val1 type=nb>,who=<dtml-sqlvar "REQUEST.AUTHENTICATED_USER">,time=now()
Called with:
sqlmethod(val1='\')
Fails with:
Error Type: ProgrammingError Error Value: ERROR: parser: parse error at or near "loginname" update tb1 set cl1='\',who='loginname',time=now()
Clearly the \ needs to be escaped. Is this Postgres specific? If so, why isn't the DA (ZPsycopg) quoting it? Running Zope 2.3.2
you are right, quoting will be fixed in the next release (we use psycopg much more than ZPsycopgDA, so this one still has some rought edges...) btw, what does 'type=nb' means? (i only know of string and int...) ciao, federico -- Federico Di Gregorio MIXAD LIVE Chief of Research & Technology fog@mixadlive.com Debian GNU/Linux Developer & Italian Press Contact fog@debian.org Try the Joy of TeX [http://www.tug.org] -- brought to you by One Line Spam
participants (3)
-
Casey Duncan -
Federico Di Gregorio -
Mayers, Philip J