From: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: From select to delete |
Date: | 2011-10-28 17:40:22 |
Message-ID: | CAADeyWg4GD9S++e+=2x1_0xj69NkwbsdQVH-_eYH=5dtych=1Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
For now I'm trying to finish my 1st approach
(without "on delete cascade") and the following
strangely fails with
ERROR: syntax error at "temp"
DETAIL: Expected record variable, row variable, or list of scalar
variables following INTO.
CONTEXT: compilation of PL/pgSQL function "pref_delete_user" near line 3
create or replace function pref_delete_user(_id varchar,
_reason varchar) returns void as $BODY$
begin
select gid into temp temp_gids from pref_scores where id=_id;
delete from pref_scores where gid in
(select gid from pref_scores where id=_id);
delete from pref_games where gid in
(select gid from pref_scores where id=_id);
delete from pref_rep where author=_id;
delete from pref_rep where id=_id;
delete from pref_catch where id=_id;
delete from pref_game where id=_id;
delete from pref_hand where id=_id;
delete from pref_luck where id=_id;
delete from pref_match where id=_id;
delete from pref_misere where id=_id;
delete from pref_money where id=_id;
delete from pref_pass where id=_id;
delete from pref_status where id=_id;
delete from pref_users where id=_id;
end;
$BODY$ language plpgsql;
Eventhough the same command works ok on the psql-prompt:
# select gid into temp temp_gids from pref_scores where id='OK446163742289';
SELECT
# select * from temp_gids ;
gid
------
1895
1946
1998
2094
2177
2215
(6 rows)
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2011-10-28 17:49:48 | Re: From select to delete |
Previous Message | Alexander Farber | 2011-10-28 17:02:45 | Re: From select to delete |