Re: [SQL] Scaler forms as function arguments

2003-11-28 Thread Greg Stark
Joe Conway <[EMAIL PROTECTED]> writes: > In 7.4 you could use an array. It would look like this: Though note that 7.4 doesn't know how to optimize this form: db=> explain select * from foo where foo_id in (1,2); QUERY PLAN

Re: [SQL] Scaler forms as function arguments

2003-11-27 Thread Joe Conway
Richard Huxton wrote: On Wednesday 26 November 2003 15:40, Andreas Tille wrote: I want to write a function of the following type CREATE FUNCTION test ( ) RETURNS setof MyTable AS 'SELECT * FROM MyTable WHERE id IN $1' LANGUAGE 'SQL' ; Not as you've done it. You c

Re: [SQL] Scaler forms as function arguments

2003-11-27 Thread Richard Huxton
On Thursday 27 November 2003 16:40, Andreas Tille wrote: > On Thu, 27 Nov 2003, Joe Conway wrote: > > Andreas Tille wrote: > > > test=# select PLpgSQLDepartmentSalaries() ; > > > > This should be: > > regression=# select * from PLpgSQLDepartmentSalaries(); > > departmentid | totalsalary > > -

Re: [SQL] Scaler forms as function arguments

2003-11-27 Thread Andreas Tille
On Thu, 27 Nov 2003, Joe Conway wrote: > Andreas Tille wrote: > > test=# select PLpgSQLDepartmentSalaries() ; > > This should be: > regression=# select * from PLpgSQLDepartmentSalaries(); > departmentid | totalsalary > --+- > 1 | 8 > 2

Re: [SQL] Scaler forms as function arguments

2003-11-27 Thread Joe Conway
Andreas Tille wrote: test=# select PLpgSQLDepartmentSalaries() ; This should be: regression=# select * from PLpgSQLDepartmentSalaries(); departmentid | totalsalary --+- 1 | 8 2 | 6 (2 rows) HTH, Joe ---

Re: [SQL] Scaler forms as function arguments

2003-11-27 Thread Andreas Tille
On Wed, 26 Nov 2003, Richard Huxton wrote: > Not as you've done it. You could pass in text "(1,2,3)", build your query and > use EXECUTE to execute it. This boils down the question to the problem which occured with your promissing link below, because I need to use PL/pgSQL, right? > Alternatively

Re: [SQL] Scaler forms as function arguments

2003-11-26 Thread Richard Huxton
On Wednesday 26 November 2003 15:40, Andreas Tille wrote: > Hi, > > I want to write a function of the following type > >CREATE FUNCTION test ( ) > RETURNS setof MyTable > AS > 'SELECT * FROM MyTable WHERE id IN $1' > LANGUAGE 'SQL' ; Not as you've done it.