From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Ken Winter <ken(at)sunward(dot)org>, PostgreSQL List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Is "IF EXISTS" legit in "ALTER TABLE ... RENAME"? |
Date: | 2015-02-16 21:44:06 |
Message-ID: | 54E264A6.20101@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 02/16/2015 01:33 PM, Ken Winter wrote:
> According to the PG 9.1 doc
> (http://www.postgresql.org/docs/current/static/sql-altertable.html)
The above is the 9.4 version of the page, note the "current" in the URL.
This is the 9.1 version of the page:
http://www.postgresql.org/docs/9.1/static/sql-altertable.html
so:
ALTER TABLE name
RENAME TO new_name
> this is a valid flavor of ALTER TABLE:
>
> ALTER TABLE [ IF EXISTS ]name
> RENAME TOnew_name
>
> But when I try to execute such a command, I get:
>
> ERROR: syntax error at or near "EXISTS"
> LINE 1: ALTER TABLE IF EXISTS event
> ^
> QUERY: ALTER TABLE IF EXISTS event
> RENAME TO event_s;
> CONTEXT: PL/pgSQL function "convert_table_to_history" line 60 at
> EXECUTE statement
>
> As you'll see, in this case the command was issued from a function. But
> issuing it directly evokes the same error.
>
> ?!?
>
> ~ Thanks in advance
> ~ Ken
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel LaMotte | 2015-02-17 11:11:16 | Re: Issue dumping schema using readonly user |
Previous Message | Ken Winter | 2015-02-16 21:33:19 | Is "IF EXISTS" legit in "ALTER TABLE ... RENAME"? |