PostGIS

LockRow

Prev

7.22. Long Transaction Support

Next

Name

LockRow — Sets lock/authorization for a row in a table.

Synopsis

+integer +LockRow(+`text `+a_schema_name, text a_table_name, text a_row_key, text an_auth_token, timestamp expire_dt`)`;

+integer +LockRow(+`text `+a_table_name, text a_row_key, text an_auth_token, timestamp expire_dt`)`;

+integer +LockRow(+`text `+a_table_name, text a_row_key, text an_auth_token`)`;

Description

Sets lock/authorization for a specific row in a table. an_auth_token is a text value. expire_dt is a timestamp which defaults to now() + 1 hour. Returns 1 if lock has been assigned, 0 otherwise (i.e. row is already locked by another auth.)

Availability: 1.1.3

Examples

SELECT LockRow('public', 'towns', '2', 'joey');
LockRow
-------
1

--Joey has already locked the record and Priscilla is out of luck
SELECT LockRow('public', 'towns', '2', 'priscilla');
LockRow
-------
0

See Also

Prev

Up

Next

EnableLongTransactions

Home

UnlockRows