Provided by: manpages-zh_1.5.2-1_all bug

NAME

       LOCK -

SYNOPSIS

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

       where lockmode is one of:

           ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE
           | SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE

DESCRIPTION

       LOCK TABLE    UNLOCK TABLE

        PostgreSQL  LOCK TABLE      SHARE    SHARE  ROW EXCLUSIVE   LOCK TABLE
       name IN SHARE MODE

          LOCK TABLE    LOCK TABLE

         SHARE ROW EXCLUSIVE  SHARE    SHARE    ROW  EXCLUSIVE     SHARE   ROW
       EXCLUSIVE  SHARE

         Section 12.3 ``Explicit Locking''

PARAMETERS

       name

                LOCK a, b;  LOCK a; LOCK b;  LOCK

       lockmode
                Section 12.3 ``Explicit Locking''

                ACCESS EXCLUSIVE

NOTES

       LOCK ... IN ACCESS SHARE MODE  SELECT  LOCK  UPDATE / DELETE

       LOCK  BEGIN...COMMIT  LOCK

       LOCK TABLE  ROW    ROW EXCLUSIVE   LOCK TABLE

EXAMPLES

         SHARE

       BEGIN WORK;
       LOCK TABLE films IN SHARE MODE;
       SELECT id FROM films
           WHERE name = 'Star Wars: Episode I - The Phantom Menace';
       -- Do ROLLBACK if record was not returned
       INSERT INTO films_user_comments VALUES
           (_id_, 'GREAT! I was waiting for it for so long!');
       COMMIT WORK;

         SHARE ROW EXCLUSIVE

       BEGIN WORK;
       LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE;
       DELETE FROM films_user_comments WHERE id IN
           (SELECT id FROM films WHERE rating < 5);
       DELETE FROM films WHERE rating < 5;
       COMMIT WORK;

COMPATIBILITY

           SQL  LOCK  TABLE   SET  TRANSACTION   PostgreSQL   SET  TRANSACTION
       [set_transaction(7)]

         ACCESS SHAREACCESS  EXCLUSIVE  SHARE  UPDATE  EXCLUSIVE    PostgreSQL
       LOCK TABLE  Oracle

       Postgresql  <laser@pgsqldb.org>