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.
2009/3/23 Craig Ringer cr...@postnewspapers.com.au
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
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 %',
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
2009/3/23 Craig Ringer cr...@postnewspapers.com.au
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
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
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 := _c2;
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
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 the
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 caused
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 record
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 some expression build from the variables tmp.id,
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
13 matches
Mail list logo