Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
When I don't have a table name matching the classname, I get cruft
# None of my table names match Sequel's expectations re: pluralization, so on
# startup I get one of these per table in my query log. Two questions:
# (1) can I shut it up?
# (2) should I worry that it's not doing the same query for the *correct* dataset name?
#
# e.g.
irb(main):005:0> class Foo2 < Sequel::Model ; set_dataset :country ;end
I, [2010-10-21T10:54:19.279871 #13554] INFO -- : (0.006494s) SELECT "pg_attribute"."attname" AS "name", format_type("pg_type"."oid", "pg_attribute"."atttypmod") AS "db_type", pg_get_expr("pg_attrdef"."adbin", "pg_class"."oid") AS "default", NOT "pg_attribute"."attnotnull" AS "allow_null", COALESCE(("pg_attribute"."attnum" = ANY("pg_index"."indkey")), false) AS "primary_key" FROM "pg_class" INNER JOIN "pg_attribute" ON ("pg_attribute"."attrelid" = "pg_class"."oid") INNER JOIN "pg_type" ON ("pg_type"."oid" = "pg_attribute"."atttypid") INNER JOIN "pg_namespace" ON ("pg_namespace"."oid" = "pg_class"."relnamespace") LEFT OUTER JOIN "pg_attrdef" ON (("pg_attrdef"."adrelid" = "pg_class"."oid") AND ("pg_attrdef"."adnum" = "pg_attribute"."attnum")) LEFT OUTER JOIN "pg_index" ON (("pg_index"."indrelid" = "pg_class"."oid") AND ("pg_index"."indisprimary" IS TRUE)) WHERE (("pg_attribute"."attisdropped" IS FALSE) AND ("pg_attribute"."attnum" > 0) AND ("pg_class"."relname" = 'foo2s') AND ("pg_namespace"."nspname" !~* 'pg_*|information_schema')) ORDER BY "pg_attribute"."attnum"
E, [2010-10-21T10:54:19.281646 #13554] ERROR -- : PGError: ERROR: relation "foo2s" does not exist
LINE 1: SELECT * FROM "foo2s" LIMIT 1
^: SELECT * FROM "foo2s" LIMIT 1
=> Foo2
@telent

This comment has been minimized.

Copy link
Owner Author

@telent telent commented Oct 21, 2010

I have a table called "country". I don't have a table called "foo2" or "foo2s". There are ten years of data in this db and other people using it - renaming is not an option ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.