[Python] problemi con psycopg2

Alessandro Dentella sandro a e-den.it
Sab 4 Apr 2015 09:55:11 CEST


On Fri, Apr 03, 2015 at 11:36:29PM +0200, Stefano Dal Pra wrote:
>    mysql> insert into dropme (a) values (1);
>    Query OK, 1 row affected, 1 warning (0.00 sec)
>    Mmmmm... Ma b non era not null?
>    mysql> select * from dropme where b='';
>    +------+---+
>    | a    | b |
>    +------+---+
>    |    1 |   |
>    +------+---+
>    Ah, ecco, ma il '' chi glie lo ha detto?
>    S


A me invece fa prudere le mani questa:


    mysql> create table junk (date date);
    Query OK, 0 rows affected (0.02 sec)

    mysql> insert into junk values('2015-02-30');
    Query OK, 1 row affected, 1 warning (0.01 sec)

    mysql> select * from junk;
    +------------+
    | date       |
    +------------+
    | 0000-00-00 |
    +------------+
    1 row in set (0.00 sec)

Quando postgres invece correttamente solleva errore:

   sandro=# create table junk (date date);
   CREATE TABLE
   sandro=# insert into junk values('2015-02-30');
   ERROR:  date/time field value out of range: "2015-02-30"
   LINE 1: insert into junk values('2015-02-30');


sandro
*:-)


Maggiori informazioni sulla lista Python