Re: NULL DATE

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: NULL DATE
Дата
Msg-id 20091017075517.GA8080@tux
обсуждение исходный текст
Ответ на NULL DATE  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Список pgsql-novice
JORGE MALDONADO <jorgemal1960@gmail.com> wrote:

> Is it possible to set a date field to nothing or null? Sometimes I need to
> initially save a date field without information and modify it later.

Sure, use NULL instead a real date.

test=# create table Jorge (id serial, d date);
HINWEIS:  CREATE TABLE erstellt implizit eine Sequenz »jorge_id_seq« für die »serial«-Spalte »jorge.id«
CREATE TABLE
Time: 207.424 ms
test=*# insert into jorge values(default, null);
INSERT 0 1
Time: 0.315 ms
test=*# insert into jorge values(default, current_date);
INSERT 0 1
Time: 0.536 ms
test=*# select * from jorge;
 id |     d
----+------------
  1 |
  2 | 2009-10-17
(2 rows)

Time: 0.260 ms
test=*#


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

В списке pgsql-novice по дате отправления:

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: NULL DATE
Следующее
От: roody senecal
Дата:
Сообщение: Synch to Database with same schema.