[Gambas-user] Gambas & PostgreSQL cannot create index. relation XXX does not exist.

Rolf Schmidt rolf.frogs at ...221...
Sat Jan 24 10:13:24 CET 2009


Hello Randy.

> STATIC PUBLIC FUNCTION CreateGLTables()
>
>   DIM hTable AS Table
>
>   hTable = Global.$hConn.Tables.Add("glcoa")
>   WITH hTable
>     .Fields.Add("company", db.String, 3)
>     .Fields.Add("account", db.String, 12)
>     .Fields.Add("description", gb.String, 32)
>     .Fields.Add("gltype", gb.String, 1)
>     .Fields.Add("glsort", gb.Integer)
>     .Fields.Add("status", gb.String, 1)
>     .PrimaryKey = ["account"]
>     .Indexes.Add("glcoa_account", "account", TRUE)
>     .Indexes.Add("glcoa_sort", "glsort", TRUE)
>     .Update
>    END WITH
>
> CATCH
>
>   Message.Error("CreateGLTables Function: " & DConv(Error.Text))
> END
>
>
> The error is "Cannot create index. relation glcoa does not exist." Why?
> Can not find any information on the internet about this error.

First of all, what is the output of the commands, when DB.debug is set. With 
this flag you get the sql-statments send to the database written in a console 
window. Then you can copy the output to the command line tool, psql or mysql 
and see, what error messages you get.

Second, you try to make an index on your primary key field, which always has 
an index, because it is the primary key.

HTH
Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090124/09627615/attachment.sig>


More information about the User mailing list