[Gambas-user] gb3 and postgresql indexes
Benoît Minisini
gambas at ...1...
Thu Sep 9 09:40:29 CEST 2010
> > ---------- Messaggio inoltrato ----------
> > From: "Benoît Minisini" <gambas at ...1...>
> > To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
> > Date: Thu, 9 Sep 2010 03:10:27 +0200
> > Subject: Re: [Gambas-user] gb3 and postgresql indexes
> >
> >> Hi to all
> >> creating a table onto a postgresql db fails when adding the index, this
> >> is my code:
> >>
> >> Public Function CreaDbUtenti() As Boolean
> >> Dim hConn As New Connection
> >> Dim hTable As Table
> >> With hConn
> >> .Host = "localhost"
> >> .Type = "postgresql"
> >> .Port = "6532"
> >> .Login = "postgres"
> >> .Password = "<postgrespwd>"
> >> .Open()
> >> End With
> >> If (Not hConn.Databases.Exist("gbputenti")) Then
> >> hConn.Databases.Add("gbputenti")
> >> hConn.Close()
> >> hConn.Name = "gbputenti"
> >> hConn.Open()
> >> hTable = hConn.Tables.Add("utenti")
> >> With hTable
> >> .Fields.Add("id", db.Serial)
> >> .Fields.Add("unome", db.String, 30)
> >> .Fields.Add("ucognome", db.String, 30)
> >> .Fields.Add("ulogin", db.String, 30)
> >> .Fields.Add("upassword", db.String, 50)
> >> .Fields.Add("ureparto", db.String, 30)
> >> .Fields.Add("uaziende", db.String, 100)
> >> .Fields.Add("utipo", db.Integer, 1, 1)
> >> .Fields.Add("ulastmodify", db.Date)
> >> .PrimaryKey = ["id"]
> >> .Update()
> >> .Indexes.Add("login", ["ulogin"], True)
> >> End With
> >> gbPneus.gbpLog.logWrite(("Creato DB Utenti."))
> >> Else
> >> gbPneus.gbpLog.logWrite(("Il DB utenti esiste."))
> >> Endif
> >> hConn.Close()
> >> Return True
> >>
> >> Catch
> >> gbPneus.gbpLog.logWrite(Subst$(("Errore durante la creazione del DB
> >> utenti: &1"), Error.Text))
> >> Return False
> >> End
> >>
> >> The server logs:
> >> ERROR column "utenti" does not exist
> >> STATEMENT CREATE UNIQUE INDEX "login" ON "utenti" ( "utenti" )
> >>
> >> The same function works fine with mysql.
> >>
> >> gambas3 rev. 3195
> >> SO Ubuntu 10.04
> >> Psql ver. 8.4.4-0 installed from binaries
> >>
> >> Any help will be appreciated,
> >> Emanuele
> >
> > Please can you run the same code by setting DB.Debug = True before, and
> > send the debugging messages?
> >
> > Thanks in advance.
> >
> > Regards,
> >
> > --
> > Benoît Minisini
>
> Thanks Benoît,
> pls teach me how can I do it...
>
> Emanuele
>
Put "DB.Debug = TRUE" before your code and run it again.
Regards,
--
Benoît Minisini
More information about the User
mailing list