Where is the problem ?
От | Piotr Adamiak |
---|---|
Тема | Where is the problem ? |
Дата | |
Msg-id | Pine.LNX.3.96.980601141400.22656A-100000@vr.pl обсуждение исходный текст |
Список | pgsql-sql |
Hi! I am a beginning postgres user and having a more or less free weekend I decided to do a test application using sql. Well all is not so great because when I run "select logz('abc','mswindows',2)\g followed by a select * from ipl_use\g I get a core dump :((( Does anybody know whats wrong ? Also How do you use the transactions (begin/end) correctly ? Also 2: Is there a way to get Insert to insert only when a condition is met such as when there is no such user ? BTW: I am running postgres 6.2.1 on a RedHat 5.* system. Best regards, /apj -----------------------------[CUT]------------------------------------ CREATE TABLE ipl_ads ( ln int4, ad varchar(60), owner varchar(60), fromwhen date, counter int4 ); CREATE TABLE ipl_use ( ln int4, user varchar(128), prog varchar(128), ad int4, wdate date, wtime time ); CREATE SEQUENCE ad_ln; CREATE SEQUENCE use_ln; create table ad_num (f1 int4); insert into ad_num values (1); create table licz (f2 int4); insert into licz values (1); create function licznik() returns int4 as 'begin; update licz set f2 = f2 + 1; end; select f2 from licz; ' language 'sql'; create function which_ad(int4) returns int4 as 'begin; update ad_num set f1 = f1 + 1 where ad_num.f1 <= $1; update ad_num set f1 = 1 where ad_num.f1 > $1; update ipl_ads set counter = counter + 1 where ipl_ads.ln = ad_num.f1; end; select ln from ipl_ads where ipl_ads.ln = ad_num.f1; ' language 'sql'; create function logz(varchar, varchar, int4) returns int4 as 'insert into ipl_use values (licznik(), $1, $2, $3, current_date, current_time); select ln from ipl_use where ipl_use.ln = licz.f2; ' language 'sql'; update licz set f2 = 2;
В списке pgsql-sql по дате отправления: