pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
locks and variable substitution
2+ messages / 2 participants
[nested] [flat]

* locks and variable substitution
@ 2003-07-25 18:49  gack@verizon.net
  0 siblings, 1 reply; 2+ messages in thread

From: gack@verizon.net @ 2003-07-25 18:49 UTC (permalink / raw)
  To: pgsql-sql

Is it possible to do variable substitution with explicit locks in plpgsql? 
Something along the lines of

...

declare
big_string alias for $1;
excl_table text;

begin
--assuming big_string starts with something like table=table1!
excl_table := substr(big_string,7,(position(''!'' in big_string)-7));

lock table excl_table in exclusive mode;

...

Thanks very much.
g.






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: locks and variable substitution
@ 2003-07-25 19:57  Eric Clark <eclark@zerohp.com>
  parent: gack@verizon.net
  0 siblings, 0 replies; 2+ messages in thread

From: Eric Clark @ 2003-07-25 19:57 UTC (permalink / raw)
  To: pgsql-sql

On Fri, 2003-07-25 at 11:49, gack@verizon.net wrote:
> 
> lock table excl_table in exclusive mode;

That probably wont work, but this will:

EXECUTE ''LOCK TABLE '' 
   || quote_ident(excl_table) || '' IN EXCLUSIVE MODE'';

Eric




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-07-25 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-25 18:49 locks and variable substitution gack@verizon.net
2003-07-25 19:57 ` Eric Clark <eclark@zerohp.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox