[SQL] using pg_tables and tablename in queries

2005-10-04 Thread solarsail
I have a large number of tables with a common naming convention       mytable001, mytable002, mytable003 ... mytable00n I would like to do a query across all of the tables, however I do not know all of the tables before hand, and I do not want to ( cant ) manually generate a query like

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread Tom Lane
solarsail <[EMAIL PROTECTED]> writes: > I have a large number of tables with a common naming convention > mytable001, mytable002, mytable003 ... mytable00n > I would like to do a query across all of the tables, however I do not know > all of the tables before hand, and I do not want to ( cant ) m

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread solarsail
The current behavior is by design. We use the table as a logging repository.  It can get very large 250 000 records.  Because of the large number of records that we have in the table we found it was much faster to perform inserts on a smaller table.  Our current system rolls the tables over  every

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread Yasir Malik
The current behavior is by design. We use the table as a logging repository. It can get very large 250 000 records. Because of the large number of records that we have in the table we found it was much faster to perform inserts on a smaller table. Our current system rolls the tables over every 12

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread Jim Buttafuoco
<[EMAIL PROTECTED]> To: Tom Lane <[EMAIL PROTECTED]> Cc: pgsql-sql@postgresql.org Sent: Tue, 4 Oct 2005 14:40:54 -0400 Subject: Re: [SQL] using pg_tables and tablename in queries > The current behavior is by design. > > We use the table as a logging repository. It can g

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread solarsail
I managed to make this work as sub query before... I wish I had written it down somewhere... Regarding the creation of a function. I do have a function that almost does that. I'm having a hard time getting it to return a set of records from the EXECUTE command ( more than one row returned by the

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread Gregory S. Williamson
Yasir -- You wrote: >If I generate a temporary table instead of returning the results how >long will that table exist for? Excuse the OOP terminology but would >it be correct to create a 'Singleton' to access the temporary table, >where if it exists and is less than 30 minutes old use that one,

Re: [SQL] using pg_tables and tablename in queries

2005-10-04 Thread Jim Buttafuoco
ct: Re: [SQL] using pg_tables and tablename in queries > I managed to make this work as sub query before... I wish I had > written it down somewhere... > > Regarding the creation of a function. I do have a function that > almost does that. I'm having a hard time getting it t

Re: [SQL] using pg_tables and tablename in queries

2005-10-05 Thread codeWarrior
"Tom Lane" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > solarsail <[EMAIL PROTECTED]> writes: >> I have a large number of tables with a common naming convention > >> mytable001, mytable002, mytable003 ... mytable00n > >> I would like to do a query across all of the tables, howeve

Re: [SQL] using pg_tables and tablename in queries

2005-10-07 Thread solarsail
Thanks for the help everyone. I got everything working. The query I was orignally looking for was something like this: SELECT * from mytable WHERE pg_tables.tablename IN ( select tablename from pg_tables where tablename like 'mytable _%' ) It turns out that isn't what I really