From: William Crawford Date: 2006-09-09T05:32:39+09:00 Subject: Re: Mrelation does not exist William Carpin wrote: > dbh = DBI.connect("DBI:Pg:mavmail:192.168.1.19", "mavmail", "") > data_sources = dbh.tables > > ...the above should return an array of table names, which it indeed > does. It's including the table names for not only the public tables, > but the ones stored in the information schema as well. Then I do the > following: > > data_sources.each{ do |table_name| > sth = dbh.prepare("SELECT something from "+table_name) > sth.execute > end > > ...and then outputs the error noted above. I believe it's crapping out > because it's running the query against non-public tables, so it can't > 'see' them. Some weird quirk with Postgres as far as I can tell. If I > could return only the public tables then it'd make my life easier... > it's back to the drawing board I guess. Hm, yeah, that's not very helpful. It doesn't seem to provide a way to tell what schema it's in or anything. If you could, you could simply do schema.table_name and it would pull it like you want. It looks like it just pulls the list of tables by doing: select tablename from pg_catalog.pg_tables; If you pulled the information yourself, you could choose only the schema 'public' and get what you want. -- Posted via http://www.ruby-forum.com/.