pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
locking a table
5+ messages / 3 participants
[nested] [flat]

* locking a table
@ 2002-12-23 17:02 Andreas Schmitz <a.schmitz@cityweb.de>
  2002-12-23 17:35 ` Re: locking a table Simone Tellini <tellini@areabusiness.it>
  0 siblings, 1 reply; 5+ messages in thread

From: Andreas Schmitz @ 2002-12-23 17:02 UTC (permalink / raw)
  To: pgsql-admin


Hello *,

I just tried to lock a table in exclusive mode following the syntax provided 
by \h lock

LOCK [ TABLE ] name [, ...] IN lockmode MODE

and I get the following result:


newsdb=# lock table dpa in lockmode 'exclusive';
ERROR:  parser: parse error at or near "lockmode" at character 19
newsdb=# lock table dpa in lockmode exclusive;
ERROR:  parser: parse error at or near "lockmode" at character 19
newsdb=#

Did I get it totally wrong and I am badly in need of some holidays or is there 
something wrong with the syntax ?

kind regards,

-andreas

-- 
Andreas Schmitz - Phone +49 201 8501 318
Cityweb-Technik-Service-Gesellschaft mbH
Friedrichstr. 12 - Fax +49 201 8501 104
45128 Essen - email a.schmitz@cityweb.de




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

* Re: locking a table
  2002-12-23 17:02 locking a table Andreas Schmitz <a.schmitz@cityweb.de>
@ 2002-12-23 17:35 ` Simone Tellini <tellini@areabusiness.it>
  2002-12-23 17:37   ` Re: locking a table Andreas Schmitz <a.schmitz@cityweb.de>
  2002-12-23 18:04   ` Re: locking a table Andreas Schmitz <a.schmitz@cityweb.de>
  0 siblings, 2 replies; 5+ messages in thread

From: Simone Tellini @ 2002-12-23 17:35 UTC (permalink / raw)
  To: pgsql-admin


On Mon, 23 Dec 2002 18:02:24 +0100
Andreas Schmitz <a.schmitz@cityweb.de> wrote:

AS> LOCK [ TABLE ] name [, ...] IN lockmode MODE
[...]
AS> newsdb=# lock table dpa in lockmode 'exclusive';
AS> ERROR:  parser: parse error at or near "lockmode" at character 19

you might want to try "lock dpa in exclusive mode;"

-- 

Simone Tellini
E-mail: tellini@areabusiness.it
http://www.areabusiness.it




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

* Re: locking a table
  2002-12-23 17:02 locking a table Andreas Schmitz <a.schmitz@cityweb.de>
  2002-12-23 17:35 ` Re: locking a table Simone Tellini <tellini@areabusiness.it>
@ 2002-12-23 17:37   ` Andreas Schmitz <a.schmitz@cityweb.de>
  1 sibling, 0 replies; 5+ messages in thread

From: Andreas Schmitz @ 2002-12-23 17:37 UTC (permalink / raw)
  To: Simone Tellini <tellini@areabusiness.it>; +Cc: pgsql-admin

On Monday 23 December 2002 18:35, Simone Tellini wrote:
> lock dpa in exclusive mode;

thanks a lot. thats it.

regards 

-andreas

-- 
Andreas Schmitz - Phone +49 201 8501 318
Cityweb-Technik-Service-Gesellschaft mbH
Friedrichstr. 12 - Fax +49 201 8501 104
45128 Essen - email a.schmitz@cityweb.de




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

* Re: locking a table
  2002-12-23 17:02 locking a table Andreas Schmitz <a.schmitz@cityweb.de>
  2002-12-23 17:35 ` Re: locking a table Simone Tellini <tellini@areabusiness.it>
@ 2002-12-23 18:04   ` Andreas Schmitz <a.schmitz@cityweb.de>
  2002-12-23 19:31     ` Re: locking a table Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 5+ messages in thread

From: Andreas Schmitz @ 2002-12-23 18:04 UTC (permalink / raw)
  To: Simone Tellini <tellini@areabusiness.it>; pgsql-admin

On Monday 23 December 2002 18:35, Simone Tellini wrote:
> On Mon, 23 Dec 2002 18:02:24 +0100
> Andreas Schmitz <a.schmitz@cityweb.de> wrote:
>
> AS> LOCK [ TABLE ] name [, ...] IN lockmode MODE
> [...]
> AS> newsdb=# lock table dpa in lockmode 'exclusive';
> AS> ERROR:  parser: parse error at or near "lockmode" at character 19
>
> you might want to try "lock dpa in exclusive mode;"

Hi,

newsdb3=# lock dpa in exclusive mode;

that one worked without errors. connecting as a normal user

 psql -U dbimport newsdb3

and doing a 

newsdb3=> select id from dpa limit 5;
   id   
--------
  73424
  73430
  69445
  73431
 109217
(5 rows)

Maybe I have a different idea of exclusive.

kind regards

-andreas

-- 
Andreas Schmitz - Phone +49 201 8501 318
Cityweb-Technik-Service-Gesellschaft mbH
Friedrichstr. 12 - Fax +49 201 8501 104
45128 Essen - email a.schmitz@cityweb.de




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

* Re: locking a table
  2002-12-23 17:02 locking a table Andreas Schmitz <a.schmitz@cityweb.de>
  2002-12-23 17:35 ` Re: locking a table Simone Tellini <tellini@areabusiness.it>
  2002-12-23 18:04   ` Re: locking a table Andreas Schmitz <a.schmitz@cityweb.de>
@ 2002-12-23 19:31     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2002-12-23 19:31 UTC (permalink / raw)
  To: a.schmitz@cityweb.de; +Cc: Simone Tellini <tellini@areabusiness.it>; pgsql-admin

Andreas Schmitz <a.schmitz@cityweb.de> writes:
> Maybe I have a different idea of exclusive.

Locks are held till the end of the current transaction ... so you need
something like

	begin;
	lock ...;
	do whatever ...;
	commit;

to do anything useful with an explicit lock.  A standalone LOCK command
will drop the lock as soon as it's acquired.

			regards, tom lane



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


end of thread, other threads:[~2002-12-23 19:31 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-23 17:02 locking a table Andreas Schmitz <a.schmitz@cityweb.de>
2002-12-23 17:35 ` Simone Tellini <tellini@areabusiness.it>
2002-12-23 17:37   ` Andreas Schmitz <a.schmitz@cityweb.de>
2002-12-23 18:04   ` Andreas Schmitz <a.schmitz@cityweb.de>
2002-12-23 19:31     ` Tom Lane <tgl@sss.pgh.pa.us>

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