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.

Respectfully,
Jorge Maldonado

Search Discussions

  • Andreas Kretschmer at Oct 17, 2009 at 7:55 am

    JORGE MALDONADO 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°

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedOct 16, '09 at 11:33p
activeOct 17, '09 at 7:55a
posts2
users2
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase