Re: [GENERAL] The tuple structure of a not-yet-assigned record is indeterminate.

2009-03-23 Thread M L
2009/3/23 Craig Ringer > M L wrote: > > > CREATE VIEW tabelka AS SELECT someint FROM t_matches; > > What exactly are you trying to do here? If it worked how you've written > it, you'd get the value of `someint' repeated once for each row that > appears in t_matches. > > I don't know exactly wh

Re: [GENERAL] The tuple structure of a not-yet-assigned record is indeterminate.

2009-03-23 Thread Craig Ringer
M L wrote: > CREATE VIEW tabelka AS SELECT someint FROM t_matches; What exactly are you trying to do here? If it worked how you've written it, you'd get the value of `someint' repeated once for each row that appears in t_matches. I don't know exactly why you're seeing the behaviour you are. H

Re: [GENERAL] The tuple structure of a not-yet-assigned record is indeterminate.

2009-03-22 Thread M L
2009/3/23 Craig Ringer > M L wrote: > > > CREATE TRIGGER league AFTER insert ON t_leagues FOR STATEMENT EXECUTE > > PROCEDURE add_view(); > > > > Then in psql I made an query and got error: > > > > league=# INSERT INTO t_leagues (name) VALUES('3liga'); > > ERROR: record "new" is not assigned ye

Re: [GENERAL] The tuple structure of a not-yet-assigned record is indeterminate.

2009-03-22 Thread Craig Ringer
M L wrote: > CREATE TRIGGER league AFTER insert ON t_leagues FOR STATEMENT EXECUTE > PROCEDURE add_view(); > > Then in psql I made an query and got error: > > league=# INSERT INTO t_leagues (name) VALUES('3liga'); > ERROR: record "new" is not assigned yet > DETAIL: The tuple structure of a no

[GENERAL] The tuple structure of a not-yet-assigned record is indeterminate.

2009-03-22 Thread M L
Hi there, i'm new to postgres. I want to create view when adding new row. So what i've got: CREATE OR REPLACE FUNCTION add_view() RETURNS trigger AS $$ DECLARE someint integer; BEGIN RAISE NOTICE 'dodajesz nowa lige %', NEW.id; someint := NEW.id; RAISE NOTICE 'dodajesz nowa lige %', somein

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A B
As a final note, it worked fine with a custom data type! :-) No problem returning values (yet) -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A B
I can try your suggestion, but I'd rather want to know why it doesn't work with the record, when you try to build it your self. It worked fine when you selected into the record. But speaking of that, If I try like you did: SELECT INTO retval RETURN NEXT retval; wouldn't that work? I think I nee

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 14:25:30 +0200 mailte A B folgendes: > I did read the select line also, and > select * from foo() as (a integer, b integer, c integer); > gives me unfortunatly the error > ERROR: record "retval" is not assigned yet > DETAIL: The tuple structure of a not-yet-assigned re

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A B
I did read the select line also, and select * from foo() as (a integer, b integer, c integer); gives me unfortunatly the error ERROR: record "retval" is not assigned yet DETAIL: The tuple structure of a not-yet-assigned record is indeterminate. So you are telling me this is an error that is cause

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 13:57:22 +0200 mailte A B folgendes: > > Sure, declare your result like my example: > > > > test=# create or replace function ab() returns setof record as $$declare r > > record; begin select into r 1,2;return next r;end;$$language plpgsql; > > Unfortunatly I have not

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A B
> Sure, declare your result like my example: > > test=# create or replace function ab() returns setof record as $$declare r > record; begin select into r 1,2;return next r;end;$$language plpgsql; Unfortunatly I have not the luxury of creating the record with a single SELECT command. Isn't there a

Re: [GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A. Kretschmer
am Mon, dem 30.06.2008, um 13:33:55 +0200 mailte A B folgendes: > In my function I have (kept the important part) > > CREATE OR REPLACE FUNCTION foo() RETURNS SETOF RECORD AS $$ > DECLARE > retval RECORD; > BEGIN > some loop >retval.jd := tmp.id; >retval.d2 := _

[GENERAL] "The tuple structure of a not-yet-assigned record is indeterminate."

2008-06-30 Thread A B
In my function I have (kept the important part) CREATE OR REPLACE FUNCTION foo() RETURNS SETOF RECORD AS $$ DECLARE retval RECORD; BEGIN some loop retval.jd := tmp.id; retval.d2 := _c2; retval.d3 := _c3; RETURN NEXT retval; end loop retu