On 12/05/2012 02:24 PM, Glenn Pierce wrote:
>
> The error I get is
>
> new row for relation "sensor_values_2011q3" violates check constraint
> "sensor_values_2011q3_timestamp_check"<br />CONTEXT: SQL statement
> "INSERT INTO sensor_values_2011q3 VALUES (NEW.*)"<br />PL/pgSQL function
> "sensor_values_timestamp_sensor_func_insert_trigger" line 32 at SQL
> statement<br /><br />
>
> I have printed the query that causes this error and it is
>
> INSERT INTO sensor_values (timestamp, value, sensor_id) VALUES
> ('2011-06-30 23:00:00.001000+00:00', '0', '2103')
>
> So the trigger has chosen the wrong child table to insert into ?
>
> The funny thing is from psql this insert query works fine. ?
>
> I am not sure why 2011-06-30 23:00:00.001000+00:00 is selected to go
> into sensor_values_2011q3 and not sensor_values_2011q2
> I suspect its due to UTC / BST as that date time is on the border of the
> contraint. Either way I not sure why I get an error and
> why does PSQL work ?
I would suspect UTC/BST also.
Do you have 'mod' logging enabled?
If so what does the INSERT from the Python script show for a time value?
If not can you log the output from the Python script to get the value?
>
> Any suggestions / help would be great
>
> Thanks
--
Adrian Klaver
adrian.klaver@gmail.com