William Crawford wrote:
> William Carpin wrote:
>> William Crawford wrote:
>>> William Carpin wrote:
>>>> select id, bounce from sql_languages where
>>>> email='mcvallejo82 / hotmail.com';
>>>> c:/ruby/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:640:in `execute': ERROR
>>>> C42P01
>>>> Mrelation "sql_languages" does not exist        Fnamespace.c    L201
>>>> RRangeVa
>>> 
>>> And of course, the table 'sql_languages' DOES exist, right?
>> 
>> Yes, the table 'sql_languages' does exist.  You don't have to try to be 
>> a smart allack about it.  I'm teaching myself this language and just 
>> wanted some help.
>> 
>> It's Postgres.  If you aren't familiar with it, each database contains 
>> various schemas.  sql_languages is in the "information_schema" schema.
> 
> I'm not being a smart aleck about it.  You'd be amazed how often it's 
> something simple that was just overlooked.

Oh, okay.  Sorry about that, i misjudged your tone!

But yeah, essentially I am using Ruby's DBI module as such 
(simplified)...

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.

-- 
Posted via http://www.ruby-forum.com/.