Wild SQL -- public/500.html -- postgres-pr


#1

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)


#2

I’m quite sure it’s part of ActiveRecord’s auto discovery process.

Won’t happen nearly as often in production mode. :slight_smile:


– Tom M.


#3

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 S.


#4

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 M.


#5

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 S.