Re: Minor systax error but not able to resolve it...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: dipti shah <shahdipti1980(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Minor systax error but not able to resolve it...
Date: 2010-02-23 15:53:55
Message-ID: 22269.1266940435@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

Richard Huxton <dev(at)archonet(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Belka Lambda 2010-02-23 16:05:14 FOREIGN KEY composite_type.its_field REFERENCES ....
Previous Message Tom Lane 2010-02-23 15:47:29 Re: pg_dump new version

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Wood 2010-02-23 16:58:58 Re: Function Error
Previous Message Alvaro Herrera 2010-02-23 15:06:39 Re: SET Role doesn't work from Security Definer Function...