| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> | 
|---|---|
| To: | Vince Vielhaber <vev(at)michvhf(dot)com> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-documentation <pgsql-docs(at)postgresql(dot)org> | 
| Subject: | Re: Use of 'now' | 
| Date: | 2001-11-14 03:40:13 | 
| Message-ID: | 200111140340.fAE3eEw21529@candle.pha.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-docs pgsql-hackers | 
> > Seems it is still in there somewhere:
> >
> > 	test=> create table bb (x timestamp default 'current', y int);
> > 	CREATE
> > 	test=> insert into bb (y) values (1);
> > 	INSERT 16591 1
> > 	test=> select * from bb;
> > 	               x               | y
> > 	-------------------------------+---
> > 	 2001-11-13 21:45:22.473896-05 | 1
> > 	(1 row)
> >
> > Do you mean that 'current' is now the same as 'now'?  :-)
> 
> ISTM that 'current' when used as a default meant the time the table
> was created but now() would (as one woule expect) return the current
> datetime.
You would think so, but in fact 'current' does change for each insert:
	test=> create table dd (x timestamp default 'current', y int);
	CREATE
	test=> insert into dd (y) values (1);
	INSERT 16596 1
	test=> insert into dd (y) values (1);
	INSERT 16597 1
	test=> select * from dd;
	               x               | y 
	-------------------------------+---
	 2001-11-13 22:39:18.283834-05 | 1
	 2001-11-13 22:39:19.196797-05 | 1
	(2 rows)
-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2001-11-14 03:58:48 | Re: Use of 'now' | 
| Previous Message | Vince Vielhaber | 2001-11-14 03:15:22 | Re: Use of 'now' | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2001-11-14 03:58:48 | Re: Use of 'now' | 
| Previous Message | Vince Vielhaber | 2001-11-14 03:15:22 | Re: Use of 'now' |