pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Timestamp with timezone with Default value
3+ messages / 3 participants
[nested] [flat]

* Timestamp with timezone with Default value
@ 2009-07-18 08:19 Gianvito Pio <pio.gianvito@gmail.com>
  2009-07-18 10:25 ` Re: Timestamp with timezone with Default value Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>
  2009-07-19 12:59 ` Re: Timestamp with timezone with Default value Jasen Betts <jasen@xnet.co.nz>
  0 siblings, 2 replies; 3+ messages in thread

From: Gianvito Pio @ 2009-07-18 08:19 UTC (permalink / raw)
  To: pgsql-sql

Hi all,
how can I define a column of timestamp with timezone type...with a default value?

Thanks

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Timestamp with timezone with Default value
  2009-07-18 08:19 Timestamp with timezone with Default value Gianvito Pio <pio.gianvito@gmail.com>
@ 2009-07-18 10:25 ` Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Jasmin Dizdarevic @ 2009-07-18 10:25 UTC (permalink / raw)
  To: Gianvito Pio <pio.gianvito@gmail.com>; pgsql-sql

Hi,

i think:
create. ...(

  myCol timestamp with timezone default now()
)
the function now() returns a timestamp with timezone (
http://www.postgresql.org/docs/8.4/static/functions-datetime.html)

i currently have no db to test it - but it should work.

jasmin
2009/7/18 Gianvito Pio <pio.gianvito@gmail.com>

>  Hi all,
> how can I define a column of timestamp with timezone type...with a default
> value?
>
> Thanks
>
>



-- 
Mit freundlichen Grüßen

Dizdarevic Jasmin
Sonnenbergstr. 3
6714 Nüziders, AUT

jasmin.dizdarevic@gmail.com
+43 664 411 79 29

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Timestamp with timezone with Default value
  2009-07-18 08:19 Timestamp with timezone with Default value Gianvito Pio <pio.gianvito@gmail.com>
@ 2009-07-19 12:59 ` Jasen Betts <jasen@xnet.co.nz>
  1 sibling, 0 replies; 3+ messages in thread

From: Jasen Betts @ 2009-07-19 12:59 UTC (permalink / raw)
  To: pgsql-sql

On 2009-07-18, Gianvito Pio <pio.gianvito@gmail.com> wrote:
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0017_01CA0791.49E30EB0
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Hi all,
> how can I define a column of timestamp with timezone type...with a =
> default value?

 Same as any other column with a default value.

If you're inserting NULL into the column the NULL will override the
default. Postgres does what you tell it. 

If you want the default value use the keyword DEFAULT (in for the
value in that column) or don't mention that column. The DEFAULT 
keyword also works with UPDATE.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-07-19 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-07-18 08:19 Timestamp with timezone with Default value Gianvito Pio <pio.gianvito@gmail.com>
2009-07-18 10:25 ` Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>
2009-07-19 12:59 ` Jasen Betts <jasen@xnet.co.nz>

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