Search Postgresql Archives

Empty to NULL conversion - Ruby - Postgres ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to copy some data from MySQL to Postgres using Ruby. This
is NOT a MySQL to PostgreSQL conversion project. I need to read the
data from a MySQL database and load it into PostgreSQL database.

How do I handle "nil" in ruby and convert them into NULL so that I can
insert NULL into INT columns instead of empty values? In short I am
getting the following popular error:

invalid input syntax for integer: "" (PGError)

This is because when I read data from MySQL, all the NULL values are
converted into "nil" in Ruby and inserting them into Postgres is an
issue because "nil" is being transmitted as "" (empty) and not as SQL
NULL.

-Venks

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux