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


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to