PyGreSQL difficulties
D'Arcy J.M. Cain
darcy at vex.net
Fri Oct 8 09:28:31 EDT 1999
Jim Driese <jdriese at seanet.com> wrote:
> Jim Driese wrote:
>>>> cnx.query("create table cities (name text,population float8,altitude
> int)");
>>>> cnx.query("create table capitals (state varchar(2)) inherits
> (cities)");
>>>> cnx.query("create unique index on cities using btree (name)");
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> pg.error: ERROR: parser: parse error at or near "on"
> So, table creation went ok but I was unable to create an index (I _can_ do
> this under psql, however). None of the sample programs had an index
> example. Does anybody know of a good online pygres reference?
I would be surprised if you could do this in psql as it is invalid syntax.
Try this.
cnx.query("create unique index cities_name on cities using btree (name)")
An index always needs a name.
Note that the semicolon is not needed in Python, btw, unless you have
multiple statements on a line.
--
D'Arcy J.M. Cain <darcy at caingang.com> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list
mailing list