Forum: Ruby on Rails Wild SQL -- public/500.html -- postgres-pr

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E6dd9cedee99f9d02e5f87d80ee0e681?d=identicon&s=25 Warren Seltzer (Guest)
on 2006-05-03 19:09
(Received via mailing list)
Every page of my DEPOT on Postgresql rails app now gets an error from
postgres-pr about
some wild left-join SQL that has nothing to do with my tables:

  SQL (0.000000)   NameError: undefined local variable or method
`errors' for
#<PostgresPR::Connection:0x3b200c0>: SELECT a.attname,
format_type(a.atttypid,
a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = 'line_items'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum


Any idea where the wild sql comes from ?  If I stop everything and swap
out the
database.yml so it points to the msysql database, and restart, it works
fine as before.
Win xpsp2, ruby 1.8.4, rails 1.1.2, postgres-pr (0.4.0)
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-05-03 19:09
(Received via mailing list)
I'm quite sure it's part of ActiveRecord's auto discovery process.

Won't happen nearly as often in production mode. :-)

--
-- Tom Mornini
E6dd9cedee99f9d02e5f87d80ee0e681?d=identicon&s=25 Fred Angstrom (warren)
on 2006-08-03 14:22
(Received via mailing list)
I'll damn make sure that bug doesn't get into production mode.  Okay
then.  Any ideas on
how to fix it?  Any ideas at all?  Please?  A wee little hint?

Warren Seltzer
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-08-03 14:22
(Received via mailing list)
Why do you think it's a bug?

ActiveRecord needs to know about the schema in order
to do it's magic. In production, it does this each
time. This allows you to add columns to your DB and
not restart everything.

In production, it assumes the schema won't be changing,
so it only needs to do this once.

--
-- Tom Mornini
E6dd9cedee99f9d02e5f87d80ee0e681?d=identicon&s=25 Fred Angstrom (warren)
on 2006-08-03 14:22
(Received via mailing list)
I didn't recognize it as schema-finding sql.  It looked loopy and was
crashing my rails
app.  Postgresql was rejecting it for some reason other than it's
apparent loopiness which
fooled me -- it was actually a failure of the C connector on winxp, not
postgresql or
rails.

Warren Seltzer
This topic is locked and can not be replied to.