Thread: column insert/alter got me stumped!

column insert/alter got me stumped!

From
"John Smith"
Date:
guys,
just wanna change value of 1 existing column

# insert into tablename (columnname) values ('value');
...works

# select columnname from tablename where columnname='value';
...works

# insert into tablename (columnname) values ('value') select
columnname from tablename where columnname='value';
or
# insert into tablename (columnname) values ('value') where columnname='value';
...combinations don't work

# alter table tablename alter column columnname set value='value';
...doesn't work either

embarrassingly simple? pgadmin III thinks so
jzs
http://www.postgresql.org/docs/8.1/static/sql-insert.html
http://www.postgresql.org/docs/8.0/static/sql-altertable.html

Re: column insert/alter got me stumped!

From
"Adam Rich"
Date:
I think you want this:

update tablename set columname = 'value'
where column2 = 'value2';



-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of John Smith
Sent: Wednesday, January 24, 2007 5:59 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] column insert/alter got me stumped!


guys,
just wanna change value of 1 existing column

# insert into tablename (columnname) values ('value');
...works

# select columnname from tablename where columnname='value';
...works

# insert into tablename (columnname) values ('value') select
columnname from tablename where columnname='value';
or
# insert into tablename (columnname) values ('value') where
columnname='value';
...combinations don't work

# alter table tablename alter column columnname set value='value';
...doesn't work either

embarrassingly simple? pgadmin III thinks so
jzs
http://www.postgresql.org/docs/8.1/static/sql-insert.html
http://www.postgresql.org/docs/8.0/static/sql-altertable.html

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq