Re: [GENERAL] Minor systax error but not able to resolve it... - Mailing list pgsql-novice

From Tom Lane
Subject Re: [GENERAL] Minor systax error but not able to resolve it...
Date
Msg-id 22269.1266940435@sss.pgh.pa.us
Whole thread Raw
In response to Minor systax error but not able to resolve it...  (dipti shah <shahdipti1980@gmail.com>)
Responses Re: [GENERAL] Minor systax error but not able to resolve it...  (dipti shah <shahdipti1980@gmail.com>)
List pgsql-novice
Richard Huxton <dev@archonet.com> writes:
> You're interpolating $cmd here but not quoting it, so you end up with:
> ... RETURNS void AS CREATE TABLE test-table...
> whereas you want:
> ... RETURNS void AS 'CREATE TABLE test-table...'...

> Probably best to use dollar-quoting: $TMP$ or similar, but don't forget
> to escapt the $ or perl will think it's a variable.

Dollar-quoting is really dangerous when you're trying to quote
nonconstant text.  I'd suggest passing the string through
quote_literal() instead.

            regards, tom lane

pgsql-novice by date:

Previous
From: Susan M Farley
Date:
Subject: Function Error
Next
From: Michael Wood
Date:
Subject: Re: Function Error