pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
adding defaults
4+ messages / 4 participants
[nested] [flat]

* adding defaults
@ 2004-07-14 16:34  Jodi Kanter <jkanter@virginia.edu>
  0 siblings, 3 replies; 4+ messages in thread

From: Jodi Kanter @ 2004-07-14 16:34 UTC (permalink / raw)
  To: pgsql-admin

Can field specific defaults easily be added to a table that is already 
in existence and has data in it?  I cannot seem to locate the correct 
ALTER command in any of my books.
Thanks
Jodi
-- 

/_______________________________
//Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu <mailto:jkanter@virginia.edu>/

 

/ /

/ /

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

* Re: adding defaults
@ 2004-07-14 16:52  Oliver Elphick <olly@lfix.co.uk>
  parent: Jodi Kanter <jkanter@virginia.edu>
  2 siblings, 0 replies; 4+ messages in thread

From: Oliver Elphick @ 2004-07-14 16:52 UTC (permalink / raw)
  To: Jodi Kanter <jkanter@virginia.edu>; +Cc: pgsql-admin

On Wed, 2004-07-14 at 17:34, Jodi Kanter wrote:
> Can field specific defaults easily be added to a table that is already
> in existence and has data in it?  I cannot seem to locate the correct
> ALTER command in any of my books.

ALTER TABLE table ALTER COLUMN column SET DEFAULT expression

-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "God is faithful, by whom ye were called unto the 
      fellowship of his Son Jesus Christ our Lord."         
                                   I Corinthians 1:9 




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

* Re: adding defaults
@ 2004-07-14 17:09  Peter Eisentraut <peter_e@gmx.net>
  parent: Jodi Kanter <jkanter@virginia.edu>
  2 siblings, 0 replies; 4+ messages in thread

From: Peter Eisentraut @ 2004-07-14 17:09 UTC (permalink / raw)
  To: Jodi Kanter <jkanter@virginia.edu>; pgsql-admin

Jodi Kanter wrote:
> Can field specific defaults easily be added to a table that is
> already in existence and has data in it?  I cannot seem to locate the
> correct ALTER command in any of my books.

ALTER TABLE a ALTER COLUMN b SET DEFAULT c;

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/




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

* Re: adding defaults
@ 2004-07-14 17:11  Rosser Schwarz <rosser.schwarz@gmail.com>
  parent: Jodi Kanter <jkanter@virginia.edu>
  2 siblings, 0 replies; 4+ messages in thread

From: Rosser Schwarz @ 2004-07-14 17:11 UTC (permalink / raw)
  To: Jodi Kanter <jkanter@virginia.edu>; pgsql-admin

Jodi Kanter wrote:

>Can field specific defaults easily be added to a table that is already
>in existence and has data in it?  I cannot seem to locate the correct
>ALTER command in any of my books.

$ psql -c "\h alter table" | grep -iC 1 default

ALTER TABLE [ ONLY ] name [ * ]
    ALTER [ COLUMN ] column { SET DEFAULT expression | DROP DEFAULT }
...

/rls

-- 
:wq



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


end of thread, other threads:[~2004-07-14 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-14 16:34 adding defaults Jodi Kanter <jkanter@virginia.edu>
2004-07-14 16:52 ` Oliver Elphick <olly@lfix.co.uk>
2004-07-14 17:09 ` Peter Eisentraut <peter_e@gmx.net>
2004-07-14 17:11 ` Rosser Schwarz <rosser.schwarz@gmail.com>

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