The edge version of do_postgres with JRuby causes misterious error like this.

   1   ~ (1) SELECT "id", "digest", "fetched_at", "created_at", "site_id" FROM "pages" WHERE ("site_id" IN (1)) ORDER BY "id"
   2   ~ ERROR: syntax error at or near "("merb : worker (port 4000) ~ ERROR: syntax error at or near "(" - (PostgresError)

The SQL that had been performed is here.

   1  SELECT "id", "digest", "fetched_at", "created_at", "site_id" FROM "pages" WHERE ("site_id" IN (1)) ORDER BY "id"

This is able to be performed successfully at the psql console. So I wonder what the error message means.

Updates

I found the bug.

For example, this code

   1  Page.repository.adapter.execute('SELECT * FROM "pages" WHERE ("id" IN ?) AND ("site_id" = ?)', [1], nil)

generates this sql

   1  SELECT * FROM "pages" WHERE ("id" IN (1)) AND ("site_id" = (NULL))

(NULL) causes parsing error.

This issue happens if the first value is an Array and the succeeding values are not Arrays.

posted by Png takiuchi on Sun 7 Jun 2009 at 20:12

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry1507
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ