[prev in list] [next in list] [prev in thread] [next in thread]
List: gambas-user
Subject: Re: [Gambas-user] Gambas & PostgreSQL cannot create index. relation
From: Randy-53 <bug.me () comcast ! net>
Date: 2009-01-24 15:49:48
Message-ID: 21641747.post () talk ! nabble ! com
[Download RAW message or body]
Rolf Schmidt wrote:
>
> 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
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
Hello Rolf,
I try to make index on any of the fields. The code that I posted is the last
try and not what I intended for indexes for the table. If I try to make
indexes on any of the fields, Gambas fails with that error message. I turn
on the DB.Bebug and try to make index for glsort field only.
Here's the debug output with index:
postgresql: 0x8159aa8: select substring(version(),12,5)
postgresql: 0x8159aa8: show client_encoding
postgresql: 0x8159aa8: select relname from pg_class where (relkind = 'r' or
relkind = 'v') and (relname = 'glcoa') and (relnamespace not in (select oid
from pg_namespace where nspname = 'information_schema'))
postgresql: 0x8159aa8: select pg_class.relname from pg_class, pg_index,
pg_class pg_class2 where pg_class2.relname = 'glcoa' and
(pg_class2.relnamespace not in (select oid from pg_namespace where nspname =
'information_schema')) and pg_index.indrelid = pg_
class2.oid and pg_index.indexrelid = pg_class.oid and pg_class.relname =
'glcoa_sort'
postgresql: 0x8159aa8: CREATE UNIQUE INDEX "glcoa_sort" ON glcoa ( glsort )
Here's the debug output without index:
postgresql: 0x8159de8: select substring(version(),12,5)
postgresql: 0x8159de8: show client_encoding
postgresql: 0x8159de8: select relname from pg_class where (relkind = 'r' or
relkind = 'v') and (relname = 'glcoa') and (relnamespace not in (select oid
from pg_namespace where nspname = 'information_schema'))
postgresql: 0x8159de8: CREATE TABLE "glcoa" ( "company" VARCHAR(3),
"account" VARCHAR(12) NOT NULL , "description" VARCHAR(32), "gltype"
VARCHAR(1), "glsort" INT, "status" VARCHAR(1), PRIMARY KEY (account) )
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "glcoa_pkey"
for table "glcoa"
With indexes Gambas doesn't create the table! Bug?
Randy :-)
--
View this message in context: \
http://www.nabble.com/Gambas---PostgreSQL-cannot-create-index.-relation-XXX-does-not-exist.-tp21605905p21641747.html
Sent from the gambas-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic