How does quotes work with dynamic queries?

From: "A B" <gentosaker(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: How does quotes work with dynamic queries?
Date: 2008-05-30 09:30:51
Message-ID: dbbf25900805300230v4a4a75dele01686f8078cd8b6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have this code iin my plpgsql function

DECLARE
foo text;
begin
foo:='bar';
execute ....

and now I want to select currval() from the sequence whose name is
stored in the foo variable, with the execute command.

can I do
execute 'select currval( \'' || foo || '\')';
?

Browse pgsql-novice by date

  From Date Subject
Next Message Mike Ellsworth 2008-05-30 10:32:38 Re: Dreamweaver 8 and PostgreSQL 'integration' with PHP???
Previous Message A B 2008-05-30 08:54:57 need help with drop table command