[GENERAL] Multiply count in select

2009-03-25 Thread M L
Hi there, I was trying this query: SELECT player.name, pos.position, count(event.event_id) AS APP, count(goal.event_id) AS GOAL FROM t_events event, t_events goal, t_players player, t_positions pos WHERE player.position_id=pos.id AND player.team_id=2 AND event.player_id=player.id AND

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

2009-03-23 Thread M L
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

[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 %',

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

2009-03-22 Thread M L
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