[SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAM

[SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAM

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Tom Lane
=?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes: >NEW.revision := addContentRevision (OLD.content_id, OLD.revision); >/* not working line, just a stub: >EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW; >*/ >RETURN NULL; This seems like the hard way. Why do

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Tom Lane schrieb: =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes: NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW; */ RETURN NULL; This seems like the

[SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Torsten Zühlsdorff
Hello, i have a problem with a trigger written in pl/pgsql. It looks like this: CREATE OR REPLACE FUNCTION versionize() RETURNS TRIGGER AS $$ BEGIN NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAM

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread Stuart
Torsten, Usually, the “insert ... (select ...)” has the select portion enclosed in parenthesis. Don't know if solution is that simple but did not see it in your examples. It may be worth a try. Stuart - Original message - > Hello, > > i have a problem with a trigger written in pl/pgs

[SQL] best paging strategies for large datasets?

2010-05-11 Thread Louis-David Mitterrand
Hi, I have a large dataset (page 1 at http://www.cruisefish.net/stat.md) and am in the process of developping a pager to let users leaf through it (30K rows). Ideally I'd like to know when requesting any 'page' of data where I am within the dataset: how many pages are available each way, etc. Of

Re: [SQL] best paging strategies for large datasets?

2010-05-11 Thread Pavel Stehule
Hello 2010/5/12 Louis-David Mitterrand : > Hi, > > I have a large dataset (page 1 at http://www.cruisefish.net/stat.md) and > am in the process of developping a pager to let users leaf through it > (30K rows). > > Ideally I'd like to know when requesting any 'page' of data where I am > within the

Re: [SQL] [Trigger] Help needed with NEW.* and TG_TABLE_NAME

2010-05-11 Thread silly sad
On 05/11/10 18:26, Torsten Zühlsdorff wrote: Tom Lane schrieb: =?ISO-8859-15?Q?Torsten_Z=FChlsdorff?= writes: NEW.revision := addContentRevision (OLD.content_id, OLD.revision); /* not working line, just a stub: EXECUTE 'INSERT INTO ' || TG_TABLE_NAME || ' SELECT $1 ' USING NEW; */ RETU