Обсуждение: BUG #4855: Explain errors on drop table if exists

Поиск
Список
Период
Сортировка

BUG #4855: Explain errors on drop table if exists

От
"Jim Michaels"
Дата:
The following bug has been logged online:

Bug reference:      4855
Logged by:          Jim Michaels
Email address:      jmichae3@yahoo.com
PostgreSQL version: 8.3.7
Operating system:   Windows XP Pro Sp3
Description:        Explain errors on drop table if exists
Details:

This syntax clearly works in the regular SQL pane and is outlined as
acceptable syntax in the manual.
Using PGAdminIII and the following query, I get this explain error:
Query result with 0 rows will be returned.

ERROR:  syntax error at or near "DROP"
LINE 91: DROP TABLE IF EXISTS work;
         ^

********** Error **********

ERROR: syntax error at or near "DROP"
SQL state: 42601
Character: 2584

DROP TABLE IF EXISTS work;
CREATE TABLE work (
  id serial UNIQUE,
  name varchar(45) NOT NULL default '',
  start_time timestamp NOT NULL default '2000-01-01 00:00:00
America/Vancouver',
  end_time timestamp NOT NULL default '2000-01-01 00:00:00
America/Vancouver',
  tasknum int  default NULL,
  prj varchar(45) default NULL,
  church int  NOT NULL default '0',
  satisfied int  NOT NULL default '0',
  PRIMARY KEY  (id)
);
--CREATE UNIQUE INDEX work_pri_id ON work(id);
CREATE INDEX work_name ON work(name);
CREATE INDEX work_start_time ON work(start_time); --sometimes I will be
starting with the start
CREATE INDEX work_end_time ON work(end_time);  --most of the time I will be
starting with the end
CREATE INDEX work_tasknum ON work(tasknum);
CREATE INDEX work_prj ON work(prj);

Re: BUG #4855: Explain errors on drop table if exists

От
Frank Heikens
Дата:
Looks like you have a hidden character before DROP. Character 2584 is
called the Lower Half Block, it might be there. Cleanup your code,
make sure there is nothing left and then execute your query again.

Good luck!

Frank



Op 16 jun 2009, om 08:58 heeft Jim Michaels het volgende geschreven:

>
> The following bug has been logged online:
>
> Bug reference:      4855
> Logged by:          Jim Michaels
> Email address:      jmichae3@yahoo.com
> PostgreSQL version: 8.3.7
> Operating system:   Windows XP Pro Sp3
> Description:        Explain errors on drop table if exists
> Details:
>
> This syntax clearly works in the regular SQL pane and is outlined as
> acceptable syntax in the manual.
> Using PGAdminIII and the following query, I get this explain error:
> Query result with 0 rows will be returned.
>
> ERROR:  syntax error at or near "DROP"
> LINE 91: DROP TABLE IF EXISTS work;
>         ^
>
> ********** Error **********
>
> ERROR: syntax error at or near "DROP"
> SQL state: 42601
> Character: 2584
>
> DROP TABLE IF EXISTS work;
> CREATE TABLE work (
>  id serial UNIQUE,
>  name varchar(45) NOT NULL default '',
>  start_time timestamp NOT NULL default '2000-01-01 00:00:00
> America/Vancouver',
>  end_time timestamp NOT NULL default '2000-01-01 00:00:00
> America/Vancouver',
>  tasknum int  default NULL,
>  prj varchar(45) default NULL,
>  church int  NOT NULL default '0',
>  satisfied int  NOT NULL default '0',
>  PRIMARY KEY  (id)
> );
> --CREATE UNIQUE INDEX work_pri_id ON work(id);
> CREATE INDEX work_name ON work(name);
> CREATE INDEX work_start_time ON work(start_time); --sometimes I will
> be
> starting with the start
> CREATE INDEX work_end_time ON work(end_time);  --most of the time I
> will be
> starting with the end
> CREATE INDEX work_tasknum ON work(tasknum);
> CREATE INDEX work_prj ON work(prj);
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

Re: BUG #4855: Explain errors on drop table if exists

От
Tom Lane
Дата:
"Jim Michaels" <jmichae3@yahoo.com> writes:
> Using PGAdminIII and the following query, I get this explain error:

> ERROR:  syntax error at or near "DROP"
> LINE 91: DROP TABLE IF EXISTS work;
>          ^

If you're not going to show us the previous 90 lines of your script,
we're not really going to be able to help you.  But I suspect it's
something as simple as having left out the semicolon on the previous
command.

            regards, tom lane