| From: | "gabriele zelasco" <rubensoda(at)inwind(dot)it> |
|---|---|
| To: | <pgsql-general(at)postgresql(dot)org> |
| Subject: | Locking rows |
| Date: | 2005-05-26 18:47:11 |
| Message-ID: | 000801c56223$5405a280$f3501897@amdykzpbht0xj0 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi.I'm using postgresql 8.0.3 under win2000 and developing with VS2003 (npgsql net provider).
I would like to start a transaction with a sql function.
When user press "edit" button on my form, i would lock the current row.
After user has modified data on form, pressing "save" button I would save the modified row by sql update function and so commit.
Well.The update function works fine.
My problem is to lock the current row.
My code is something like:
CREATE OR REPLACE FUNCTION "public"."new_function" () RETURNS SETOF "public"."table" AS
$body$
begin;
select * from table where field = 'value' for update;
$body$
LANGUAGE 'sql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
But I get :
ERROR , BEGIN IS NOT ALLOWED IN SQL FUNCTION
What's wrong?
Please tell me if it's a syntax problem
maybe have I to use pgsql ?
How can I lock row in pgsql ?
Thanks in advance.
| Attachment | Content-Type | Size |
|---|---|---|
| unknown_filename | text/plain | 139 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Marlowe | 2005-05-26 18:51:00 | Re: pg_listener records |
| Previous Message | David Parker | 2005-05-26 18:41:47 | pg_listener records |