Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created January 19, 2012 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcoyne/1643262 to your computer and use it in GitHub Desktop.
Save jcoyne/1643262 to your computer and use it in GitHub Desktop.
jruby postresql error
1.9.3p0 :003 > Metastore.find(304156028, 304654300, 304669715)
Metastore Load (280.2ms) SELECT "public"."metastore".* FROM "public"."metastore" WHERE "public"."metastore"."id" IN (304156028, 304654300, 304669715)
=> [#<Metastore id: 304156028, dedup: 181874021, doctype: 1, source: 2, xml: "<sf:art xmlns:xsi=\"http://www.w3.org/2001/XMLSchema...">, #<Metastore id: 304654300, dedup: 181874021, doctype: 1, source: 3, xml: "<sf:art xmlns:xsi=\"http://www.w3.org/2001/XMLSchema...">, #<Metastore id: 304669715, dedup: 181874021, doctype: 1, source: 11, xml: "<sf:art xmlns:xsi=\"http://www.w3.org/2001/XMLSchema...">]
jruby-1.6.5.1 :001 > Metastore.find(304156028, 304654300, 304669715)
PK and serial sequence (3.0ms) SELECT attr.attname, seq.relname
FROM pg_class seq,
pg_attribute attr,
pg_depend dep,
pg_namespace name,
pg_constraint cons
WHERE seq.oid = dep.objid
AND seq.relkind = 'S'
AND attr.attrelid = dep.refobjid
AND attr.attnum = dep.refobjsubid
AND attr.attrelid = cons.conrelid
AND attr.attnum = cons.conkey[1]
AND cons.contype = 'p'
AND dep.refobjid = '"public"."metastore"'::regclass
PK and custom sequence (2.0ms) SELECT attr.attname,
CASE
WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN
substr(split_part(def.adsrc, '''', 2),
strpos(split_part(def.adsrc, '''', 2), '.')+1)
ELSE split_part(def.adsrc, '''', 2)
END as relname
FROM pg_class t
JOIN pg_attribute attr ON (t.oid = attrelid)
JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)
JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])
WHERE t.oid = '"public"."metastore"'::regclass
AND cons.contype = 'p'
AND def.adsrc ~* 'nextval'
PK and serial sequence (2.0ms) SELECT attr.attname, seq.relname
FROM pg_class seq,
pg_attribute attr,
pg_depend dep,
pg_namespace name,
pg_constraint cons
WHERE seq.oid = dep.objid
AND seq.relkind = 'S'
AND attr.attrelid = dep.refobjid
AND attr.attnum = dep.refobjsubid
AND attr.attrelid = cons.conrelid
AND attr.attnum = cons.conkey[1]
AND cons.contype = 'p'
AND dep.refobjid = '"public"."metastore"'::regclass
PK and custom sequence (1.0ms) SELECT attr.attname,
CASE
WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN
substr(split_part(def.adsrc, '''', 2),
strpos(split_part(def.adsrc, '''', 2), '.')+1)
ELSE split_part(def.adsrc, '''', 2)
END as relname
FROM pg_class t
JOIN pg_attribute attr ON (t.oid = attrelid)
JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)
JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])
WHERE t.oid = '"public"."metastore"'::regclass
AND cons.contype = 'p'
AND def.adsrc ~* 'nextval'
Metastore Load (9.0ms) SELECT "public"."metastore".* FROM "public"."metastore" WHERE "public"."metastore"."" IN (304156028, 304654300, 304669715)
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: ERROR: zero-length delimited identifier at or near """"
Position: 85: SELECT "public"."metastore".* FROM "public"."metastore" WHERE "public"."metastore"."" IN (304156028, 304654300, 304669715)
from arjdbc/jdbc/RubyJdbcConnection.java:191:in `execute'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:216:in `_execute'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:208:in `execute'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `log'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activesupport-3.1.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:208:in `execute'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:334:in `select'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/base.rb:470:in `find_by_sql'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/relation.rb:111:in `to_a'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/relation/finder_methods.rb:159:in `all'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/relation/finder_methods.rb:346:in `find_some'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/relation/finder_methods.rb:313:in `find_with_ids'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/relation/finder_methods.rb:107:in `find'
from org/jruby/RubyBasicObject.java:1715:in `__send__'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/activerecord-3.1.3/lib/active_record/base.rb:441:in `find'
from (irb):1:in `evaluate'
from org/jruby/RubyKernel.java:1093:in `eval'
from org/jruby/RubyKernel.java:1420:in `loop'
from org/jruby/RubyKernel.java:1206:in `catch'
from org/jruby/RubyKernel.java:1206:in `catch'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/jruby-1.6.5.1/gems/railties-3.1.3/lib/rails/commands.rb:40:in `(root)'
from org/jruby/RubyKernel.java:1047:in `require'
from script/rails:6:in `(root)
'jruby-1.6.5.1 :002 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment