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