0

I want to rename the column in Postgresql database. The column name i am having is :

id varchar ?column? text name varchar 

I have tried using the following command:

alter table <table_name> rename column '?column?' to age; 

But i am getting error. Please help me in renaming the column without dropping or recreating the table.

1
  • 1
    "but I am getting error". What error? show the exact text of the error message in questions about errors, as well as your PostgreSQL version. In this case we can guess what's going on pretty easily, but that won't always be the case and you'll get a better response from people if you provide all the details. Commented Mar 19, 2013 at 11:20

1 Answer 1

4

Use double quotes for identifiers:

alter table <table_name> rename column "?column?" to age; 
Sign up to request clarification or add additional context in comments.

1 Comment

Heh, within a second of each other. Removing my answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.