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

Ron_1st ronstk at ...239...
Sun Feb 1 19:20:45 CET 2009


On Sunday 01 February 2009, Benoit Minisini wrote:
> On jeudi 22 janvier 2009, Randy wrote:
> > Hello.
> >
> > New to Gambas and having problems with following code:
> >
> > 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.
> >
> > Help :-(
> > Randy
> >
> 
> Finally, this is not a bug. Just that the database component can only create 
> indexes on already existing tables. 
> 
> And the table you are creating does not exist until you call the "Update" 
> method. So you just have to move the ".Update" line just before 
> the ".Indexes..." lines.
> 
> Regards,
> 

Just as I told to do in my last post on this subject
jummy I was right :)





Best regards,

Ron_1st

-- 




More information about the User mailing list