[SQL] (Mis)using the PostgreSQL planner to get estimated row counts

2005-05-30 Thread Nick Johnson
I'm trying to write a PostgreSQL extension to estimate the number of rows returned by a SELECT statement. Ideally, it'd be invoked along the lines of "SELECT estimate_row_count('SELECT foo FROM bar INNER JOIN baz ON (id) WHERE a=b');", and would be useful for estimating the number of pages

Re: [SQL] Impossible with pl/pgsql?

2005-05-30 Thread Tom Lane
Markus Bertheau =?UTF-8?Q?=E2=98=AD?= <[EMAIL PROTECTED]> writes: > I have a function find() that returns a SETOF INT. I further have a > function decorate as follows: > CREATE TYPE decorate_type AS (id INT, name TEXT, author TEXT, > last_change TIMESTAMP); > CREATE FUNCTION decorate(INT) >

Re: [SQL] Impossible with pl/pgsql?

2005-05-30 Thread Michael Fuhr
On Mon, May 30, 2005 at 05:15:55PM +0200, Markus Bertheau ??? wrote: > > Now how would a query look like that involves find() and decorate() and > returns > > id | name | author | last_change > > 4 | egg | john | 2003-05-05 > 5 | ham | dave | 2004-03-01 E

[SQL] Impossible with pl/pgsql?

2005-05-30 Thread Markus Bertheau ☭
Hi, I have a function find() that returns a SETOF INT. I further have a function decorate as follows: CREATE TYPE decorate_type AS (id INT, name TEXT, author TEXT, last_change TIMESTAMP); CREATE FUNCTION decorate(INT) RETURNS decorate_type STABLE LANGUAGE 'plpgsql'

Re: [SQL] Generic Join on Arrays

2005-05-30 Thread KÖPFERL Robert
Thanks. Since I was just interested in this special case (while the general wasn't interesting, either) this helped me. Also psql -E is a nice new feature to me. |-Original Message- |From: Michael Fuhr [mailto:[EMAIL PROTECTED] |Sent: Montag, 30. Mai 2005 16:09 |To: KÖPFERL Robert |Cc: pgs

Re: [SQL] Generic Join on Arrays

2005-05-30 Thread Michael Fuhr
On Mon, May 30, 2005 at 03:42:49PM +0200, KÖPFERL Robert wrote: > > As I found out, pg_proc relation provides me with data about defined stored > procedures. Togehter with other relations as pg_type I can retrieve readable > information, like: > select proname, pd.description FROM pg_proc pp left

[SQL] Generic Join on Arrays

2005-05-30 Thread KÖPFERL Robert
Hi, I'm currently on retrieving meta infromation about db-schemas. As I found out, pg_proc relation provides me with data about defined stored procedures. Togehter with other relations as pg_type I can retrieve readable information, like: select proname, pd.description FROM pg_proc pp left outer