[Gambas-user] Problem with Postgresql

rolf rolf.frogs at ...221...
Mon Jul 10 16:06:17 CEST 2006


Hi Ron

> > - CODE:  
> >   query1 = "alter table _" & TextBox.Text & " add column id serial not
> > null"   res1 = hDB.Exec(quer<1)
> >
> > if a primary key should be set with a code like:
> >     query1 = "ALTER TABLE ONLY _" & TextBox.Text &
> >                      " ADD CONSTRAINT X" & TextBox.Text &
> >                      "_pkey PRIMARY KEY (id)"
> >    res1 = hDB.Exec(query1)
>
> What are those underscores?

They are used, because the tablename is a number (of a bank account). If I use 
pure numbered tablenames they always must be double quoted with mouch more 
trouble.

> In example on postgres site: 'ALTER TABLE table_name ADD'

All the comands work in the psql-shell without any error! I printed out the 
commands in a file and passed this file as input to psql and again all 
commands will execute as expected without any error.

>
> Leave those underscore away or do you have really a table starting with '_'
> ?
>
> " ADD CONSTRAINT X" & TextBox.Text & "_pkey PRIMARY KEY (id)"
> This looks as 'CONSTRAINT Xmyname_pkey PRIMARY' are you sure this correct?
>
> Maybe also case sensitive can be a problem.

Postgres is case sensitive in table, column and database names, not in sql 
commands.

I found a discussion on the postgres mailing list about this problem - with 
version 8.1.1 - I use 8.1.4 - but in spanish, which I don't understand.

Because all the trouble making sql commands work in the psql-shell I am not 
shure, if gambas is linked against the right libraries or uses the right 
function calls. I recompiled gambas (using 1.9.31 because the documentation 
is still usable) and will test it.

Many thanks for your help.
Rolf




More information about the User mailing list