Project

General

Profile

[Solved] Internal Error when setting "log time" fields

Added by Diego Molina over 10 years ago

Description of the system

System details:
  • Ruby version string: ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
  • Rails version string: Rails 2.3.11
  • Operating system string: Gentoo Linux amd64
  • Database: PostgreSQL 8.4
  • Web server used: apache + passenger
  • script/about output:
    About your application's environment
    Ruby version              1.8.7 (x86_64-linux)
    RubyGems version          1.3.7
    Rack version              1.1
    Rails version             2.3.11
    Active Record version     2.3.11
    Active Resource version   2.3.11
    Action Mailer version     2.3.11
    Active Support version    2.3.11
    Application root          /var/lib/redmine
    Environment               production
    Database adapter          postgresql
    Database schema version   2011051100000

Description of the problem

When creating/updating an issue using the "log time" fields, the server threw an "Internal Error", so I checked the logs and verified it was failing to insert into the database with the message

ActiveRecord::StatementInvalid (PGError: ERROR:  INSERT tiene más expresiones que columnas de destino
Which is the same as (in English):
ActiveRecord::StatementInvalid (PGError: ERROR:  INSERT has more expressions than target columns

As you can guess, we speak spanish. So, tried a lot of things in the few weeks (some of them obscure, I'm afraid...), nothing on the Internet, no ruby dev available either in the organization. In the log it was available the SQL sentence being executed, so counting the expressions and the target columns was showing a difference, so the DB was not suspicious. An hour ago, and after shouting to the monitor with a swollen vein in the neck, finally actually "saw" the SQL sentence in the log and realized that one of the params was like this: "10:57:47.023986', 8, 1,0, 2013, 39)". The "1,0" part didn't actually looked like two expressions, but a single floating point number "in Spanish" (in English you write "1,000.13", in Spanish and a lot other languages you write "1.000,13", which is "one thousand and thirteen over one hundred").

The solution

Pretty simple. Added "LC_NUMERIC=C" to my environment and restarted apache2.

Greetings.