Re: Detalles de MySQL, para quien le interese...

From: "Marcos Saldivar" <baron(dot)rojo(dot)cuerdas(dot)de(dot)acero(at)gmail(dot)com>
To: "Gunnar Wolf" <gwolf(at)gwolf(dot)org>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Detalles de MySQL, para quien le interese...
Date: 2008-03-27 14:53:16
Message-ID: 1c4d91ab0803270753i2b4085d6ke38513f5b731555@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2008/3/27, Gunnar Wolf <gwolf(at)gwolf(dot)org>:
> Marcos Saldivar dijo [Thu, Mar 27, 2008 at 11:39:18AM -0300]:
>
> > > mysql> INSERT INTO log SET noted = '0000-00-00';
> > > Query OK, 1 row affected (0.00 sec)
> >
> > Recuerdo que esto sucedia hace mucho tiempo en versiones como la 3 o 4
> > quizas ya cambio en versiones mas nuevas, incluso se podia ingresar el
> > '2008-02-31' sin problemas...
>
>
> Asómate al texto - Sigue siendo válido, a menos que especifiques (en
> tu configuración o en tu cliente):
>
> SET sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE';
>
> Que es, según esto, equivalente a:
>
> SET sql_mode = 'TRADITIONAL';

Sip tienes razon aqui en mi Desktop con CentOS 5(mysql 5.0.22), paso
lo siguiente:

mysql> create table foo(fecha date);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into foo values('2008-02-31');
Query OK, 1 row affected, 1 warning (0.01 sec)

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

mysql> SET sql_mode = 'TRADITIONAL';
Query OK, 0 rows affected (0.00 sec)

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

mysql> insert into foo values('2008-02-31');
ERROR 1292 (22007): Incorrect date value: '2008-02-31' for column
'fecha' at row 1

Y en postgresql:

dberp=# create table foo(fecha date);
CREATE TABLE
dberp=# insert into foo values('2008-02-31');
ERROR: el valor de hora/fecha está fuera de rango: «2008-02-31»
dberp=#

Saludos.-

>
> Pero no es default.
>
>
> --
>
> Gunnar Wolf - gwolf(at)gwolf(dot)org - (+52-55)5623-0154 / 1451-2244
> PGP key 1024D/8BB527AF 2001-10-23
> Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF
>

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Gilberto Castillo Martínez 2008-03-27 15:01:53 Uso table_log
Previous Message Gunnar Wolf 2008-03-27 14:43:29 Re: Detalles de MySQL, para quien le interese...