pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed[SQL] empty data
3+ messages / 3 participants
[nested] [flat]
* [SQL] empty data
@ 1998-07-13 10:51 Sergio Brandano <serbr@tin.it>
0 siblings, 1 reply; 3+ messages in thread
From: Sergio Brandano @ 1998-07-13 10:51 UTC (permalink / raw)
To: pgsql-sql; +Cc: serbr@tin.it
> serbr=> CREATE TABLE foo (mtdata date);
> CREATE
> serbr=> \dt
>
> Database = serbr
> +------------------+----------------------------------+----------+
> | Owner | Relation | Type |
> +------------------+----------------------------------+----------+
> | serbr | foo | table |
> +------------------+----------------------------------+----------+
> serbr=> INSERT INTO foo VALUES ('');
> ERROR: Bad date external representation
> serbr=> INSERT INTO foo VALUES ('//');
> ERROR: Bad date external representation
My problem arise in a more general context, where the date may not
be available at the time of data insert/update, and the data must
be empty.
What can I do? (I would not like to define a my own date-type...)
Sergio
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] empty data
@ 1998-07-13 16:30 Stuart Rison <stuart@ludwig.ucl.ac.uk>
0 siblings, 0 replies; 3+ messages in thread
From: Stuart Rison @ 1998-07-13 16:30 UTC (permalink / raw)
To: pgsql-sql; +Cc: serbr@tin.it
>> serbr=> CREATE TABLE foo (mtdata date);
>> CREATE
>> serbr=> \dt
>>
>> Database = serbr
>> +------------------+----------------------------------+----------+
>> | Owner | Relation | Type |
>> +------------------+----------------------------------+----------+
>> | serbr | foo | table |
>> +------------------+----------------------------------+----------+
>> serbr=> INSERT INTO foo VALUES ('');
>> ERROR: Bad date external representation
>> serbr=> INSERT INTO foo VALUES ('//');
>> ERROR: Bad date external representation
>
> My problem arise in a more general context, where the date may not
> be available at the time of data insert/update, and the data must
> be empty.
>
> What can I do? (I would not like to define a my own date-type...)
Try insert into foo values (NULL);
Naturally, this is silly in the example you give since you are putting a
NULL in a single field table and therefore you might as well not put a
value in.
Hope this helps.
Stuart.
+-------------------------+--------------------------------------+
| Stuart Rison | Ludwig Institute for Cancer Research |
+-------------------------+ University College London |
| Tel. (0171) 878 4041 | 91 Riding House Street |
| Fax. (0171) 878 4040 | London, W1P 8BT, UNITED KINGDOM. |
+-------------------------+--------------------------------------+
| stuart@NOJUNK_ludwig.ucl.ac.uk [Remove NOJUNK_ for it to work] |
+----------------------------------------------------------------+
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] empty data
@ 1998-07-13 17:26 Guido Piazzi <gpiazzi@nemo.it>
parent: Sergio Brandano <serbr@tin.it>
0 siblings, 0 replies; 3+ messages in thread
From: Guido Piazzi @ 1998-07-13 17:26 UTC (permalink / raw)
To: Sergio Brandano <serbr@tin.it>; +Cc: pgsql-sql
On Mon, 13 Jul 1998, Sergio Brandano wrote:
> > serbr=> CREATE TABLE foo (mtdata date);
> > CREATE
> > serbr=> INSERT INTO foo VALUES ('');
> > ERROR: Bad date external representation
guido=> INSERT INTO foo VALUES (null);
INSERT 144906 1
Postgres doesn't like empty strings for date fields.
When using the COPY command (for loading data from a file)
null date fields should contain \N (backslash, capital N).
regards,
------------------------------------------------------------------------
// Guido Carlo Piazzi Accompagnatore naturalistico
// gpiazzi@nemo.it Visitate il sito WWW.ParcoDelTicino.Pmn.It
------------------------------------------------------------------------
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~1998-07-13 17:26 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-07-13 10:51 [SQL] empty data Sergio Brandano <serbr@tin.it>
1998-07-13 17:26 ` Guido Piazzi <gpiazzi@nemo.it>
1998-07-13 16:30 Re: [SQL] empty data Stuart Rison <stuart@ludwig.ucl.ac.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox