Thread: Interface

Interface

From
Bob Pawley
Date:
The folks on the Delphi forum haven't been responsive to this question. Perhaps the ones that visit the forum don't know the answer.
 
I have created a Delphi interface to a Postgresql table containing a serial column.
 
When I try to insert a new value through the interface I get an error message that the serial field requires a value.
 
When I remove the serial column the interface inserts a new value with no problem. When I insert directly via sql the serial column updates automatically.
 
What am I missing to make this work through Delphi?
 
Bob

Re: Interface

From
"Joshua D. Drake"
Date:
Bob Pawley wrote:
> The folks on the Delphi forum haven't been responsive to this question.
> Perhaps the ones that visit the forum don't know the answer.
>
> I have created a Delphi interface to a Postgresql table containing a
> serial column.
>
> When I try to insert a new value through the interface I get an error
> message that the serial field requires a value.
>
> When I remove the serial column the interface inserts a new value with
> no problem. When I insert directly via sql the serial column updates
> automatically.
>
> What am I missing to make this work through Delphi?

Try using DEFAULT as the serial value.. e.g;

INSERT INTO foo VALUES (DEFAULT, 'Hello');

Where DEFAULT is the serial column.

Sincerely,

Joshua D. Drake


>
> Bob


--

            === The PostgreSQL Company: Command Prompt, Inc. ===
      Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
      Providing the most comprehensive  PostgreSQL solutions since 1997
                     http://www.commandprompt.com/



Re: Interface

From
"Frank L. Parks"
Date:
Bob,

Can you at least show what your insert statement looks like please?
Also, are you using ODBC or VitaVoom's direct driver for DBExpress?

Frank

Bob Pawley wrote:

> The folks on the Delphi forum haven't been responsive to this
> question. Perhaps the ones that visit the forum don't know the answer.
>
> I have created a Delphi interface to a Postgresql table containing a
> serial column.
>
> When I try to insert a new value through the interface I get an error
> message that the serial field requires a value.
>
> When I remove the serial column the interface inserts a new value with
> no problem. When I insert directly via sql the serial column updates
> automatically.
>
> What am I missing to make this work through Delphi?
>
> Bob



Re: Interface

From
Bob Pawley
Date:
Hi Frank

Here's the code entered as part of TUpdateSQL component.
insert into p_id.p_id
  (process_name)
values
  (:process_name)

I am connected via ODBC.

Thanks

Bob

----- Original Message -----
From: "Frank L. Parks" <fparks@ezbizpartner.com>
To: "Postgresql" <pgsql-general@postgresql.org>
Sent: Wednesday, May 10, 2006 12:30 PM
Subject: Re: [GENERAL] Interface


> Bob,
>
> Can you at least show what your insert statement looks like please?
> Also, are you using ODBC or VitaVoom's direct driver for DBExpress?
>
> Frank
>
> Bob Pawley wrote:
>
>> The folks on the Delphi forum haven't been responsive to this
>> question. Perhaps the ones that visit the forum don't know the answer.
>>
>> I have created a Delphi interface to a Postgresql table containing a
>> serial column.
>>
>> When I try to insert a new value through the interface I get an error
>> message that the serial field requires a value.
>>
>> When I remove the serial column the interface inserts a new value with
>> no problem. When I insert directly via sql the serial column updates
>> automatically.
>>
>> What am I missing to make this work through Delphi?
>>
>> Bob
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

Re: Interface

From
"Joshua D. Drake"
Date:
Bob Pawley wrote:
> Hi Frank
>
> Here's the code entered as part of TUpdateSQL component.
> insert into p_id.p_id
>  (process_name)
> values
>  (:process_name)
>

Did my DEFAULT not work?

Joshua D. Drake


> I am connected via ODBC.
>
> Thanks
>
> Bob
>
> ----- Original Message ----- From: "Frank L. Parks"
> <fparks@ezbizpartner.com>
> To: "Postgresql" <pgsql-general@postgresql.org>
> Sent: Wednesday, May 10, 2006 12:30 PM
> Subject: Re: [GENERAL] Interface
>
>
>> Bob,
>>
>> Can you at least show what your insert statement looks like please?
>> Also, are you using ODBC or VitaVoom's direct driver for DBExpress?
>>
>> Frank
>>
>> Bob Pawley wrote:
>>
>>> The folks on the Delphi forum haven't been responsive to this
>>> question. Perhaps the ones that visit the forum don't know the answer.
>>>
>>> I have created a Delphi interface to a Postgresql table containing a
>>> serial column.
>>>
>>> When I try to insert a new value through the interface I get an error
>>> message that the serial field requires a value.
>>>
>>> When I remove the serial column the interface inserts a new value
>>> with no problem. When I insert directly via sql the serial column
>>> updates automatically.
>>>
>>> What am I missing to make this work through Delphi?
>>>
>>> Bob
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 6: explain analyze is your friend
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>


--

            === The PostgreSQL Company: Command Prompt, Inc. ===
      Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
      Providing the most comprehensive  PostgreSQL solutions since 1997
                     http://www.commandprompt.com/



Re: Interface

From
Bob Pawley
Date:
Joshua

My first try was to include it with the SQL code on the Update component.
It hasn't worked yet. I want to try variations.

I am also trying a Query component which gave me the same error. I also have
another problem with this component giving me a cursor handle error which I
am attempting to solve. (Same SQL code)

Lots of challenges for a beginner to work through.

Bob
----- Original Message -----
From: "Joshua D. Drake" <jd@commandprompt.com>
To: "Bob Pawley" <rjpawley@shaw.ca>
Cc: "Frank L. Parks" <fparks@ezbizpartner.com>; "Postgresql"
<pgsql-general@postgresql.org>
Sent: Wednesday, May 10, 2006 3:41 PM
Subject: Re: [GENERAL] Interface


> Bob Pawley wrote:
>> Hi Frank
>>
>> Here's the code entered as part of TUpdateSQL component.
>> insert into p_id.p_id
>>  (process_name)
>> values
>>  (:process_name)
>>
>
> Did my DEFAULT not work?
>
> Joshua D. Drake
>
>
>> I am connected via ODBC.
>>
>> Thanks
>>
>> Bob
>>
>> ----- Original Message ----- From: "Frank L. Parks"
>> <fparks@ezbizpartner.com>
>> To: "Postgresql" <pgsql-general@postgresql.org>
>> Sent: Wednesday, May 10, 2006 12:30 PM
>> Subject: Re: [GENERAL] Interface
>>
>>
>>> Bob,
>>>
>>> Can you at least show what your insert statement looks like please?
>>> Also, are you using ODBC or VitaVoom's direct driver for DBExpress?
>>>
>>> Frank
>>>
>>> Bob Pawley wrote:
>>>
>>>> The folks on the Delphi forum haven't been responsive to this question.
>>>> Perhaps the ones that visit the forum don't know the answer.
>>>>  I have created a Delphi interface to a Postgresql table containing a
>>>> serial column.
>>>>  When I try to insert a new value through the interface I get an error
>>>> message that the serial field requires a value.
>>>>  When I remove the serial column the interface inserts a new value with
>>>> no problem. When I insert directly via sql the serial column updates
>>>> automatically.
>>>>  What am I missing to make this work through Delphi?
>>>>  Bob
>>>
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 6: explain analyze is your friend
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: don't forget to increase your free space map settings
>>
>
>
> --
>
>            === The PostgreSQL Company: Command Prompt, Inc. ===
>      Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
>      Providing the most comprehensive  PostgreSQL solutions since 1997
>                     http://www.commandprompt.com/
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match


Re: Interface

From
Bob Pawley
Date:
To refresh people's memory I have a simple Delphi interface (TEdit and
TNavigator) connected via ODBC to a Postgresql 8.0 table.

I've tried the earlier suggestions in various forms with no success.

I again was successful in updating the table with the table containing no
serial column. With the serial column included I get an error massage that
the serial column needs a value.

I don't understand why the serial column is generated when a row is created
manually through Postgresql Admin interface but it doesn't generate when a
row is added through the Delphi interface.

Could someone explain this difference?

Bob Pawley


----- Original Message -----
From: "Bob Pawley" <rjpawley@shaw.ca>
To: "Joshua D. Drake" <jd@commandprompt.com>
Cc: "Frank L. Parks" <fparks@ezbizpartner.com>; "Postgresql"
<pgsql-general@postgresql.org>
Sent: Wednesday, May 10, 2006 3:55 PM
Subject: Re: [GENERAL] Interface


> Joshua
>
> My first try was to include it with the SQL code on the Update component.
> It hasn't worked yet. I want to try variations.
>
> I am also trying a Query component which gave me the same error. I also
> have another problem with this component giving me a cursor handle error
> which I am attempting to solve. (Same SQL code)
>
> Lots of challenges for a beginner to work through.
>
> Bob
> ----- Original Message -----
> From: "Joshua D. Drake" <jd@commandprompt.com>
> To: "Bob Pawley" <rjpawley@shaw.ca>
> Cc: "Frank L. Parks" <fparks@ezbizpartner.com>; "Postgresql"
> <pgsql-general@postgresql.org>
> Sent: Wednesday, May 10, 2006 3:41 PM
> Subject: Re: [GENERAL] Interface
>
>
>> Bob Pawley wrote:
>>> Hi Frank
>>>
>>> Here's the code entered as part of TUpdateSQL component.
>>> insert into p_id.p_id
>>>  (process_name)
>>> values
>>>  (:process_name)
>>>
>>
>> Did my DEFAULT not work?
>>
>> Joshua D. Drake
>>
>>
>>> I am connected via ODBC.
>>>
>>> Thanks
>>>
>>> Bob
>>>
>>> ----- Original Message ----- From: "Frank L. Parks"
>>> <fparks@ezbizpartner.com>
>>> To: "Postgresql" <pgsql-general@postgresql.org>
>>> Sent: Wednesday, May 10, 2006 12:30 PM
>>> Subject: Re: [GENERAL] Interface
>>>
>>>
>>>> Bob,
>>>>
>>>> Can you at least show what your insert statement looks like please?
>>>> Also, are you using ODBC or VitaVoom's direct driver for DBExpress?
>>>>
>>>> Frank
>>>>
>>>> Bob Pawley wrote:
>>>>
>>>>> The folks on the Delphi forum haven't been responsive to this
>>>>> question. Perhaps the ones that visit the forum don't know the answer.
>>>>>  I have created a Delphi interface to a Postgresql table containing a
>>>>> serial column.
>>>>>  When I try to insert a new value through the interface I get an error
>>>>> message that the serial field requires a value.
>>>>>  When I remove the serial column the interface inserts a new value
>>>>> with no problem. When I insert directly via sql the serial column
>>>>> updates automatically.
>>>>>  What am I missing to make this work through Delphi?
>>>>>  Bob
>>>>
>>>>
>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 6: explain analyze is your friend
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 5: don't forget to increase your free space map settings
>>>
>>
>>
>> --
>>
>>            === The PostgreSQL Company: Command Prompt, Inc. ===
>>      Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
>>      Providing the most comprehensive  PostgreSQL solutions since 1997
>>                     http://www.commandprompt.com/
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>>       choose an index scan if your joining column's datatypes do not
>>       match
>


Re: Interface

From
"Jim C. Nasby"
Date:
I suspect that Delphi is specifying the serial column in the insert
statement, but then not assigning it a value (if you turn on query
logging you'll be able to confirm that). If that's the case, you could
write an insert trigger that would set the serial column's value to
nextval for the appropriate sequence if it's null.

On Thu, May 18, 2006 at 09:02:51AM -0700, Bob Pawley wrote:
> To refresh people's memory I have a simple Delphi interface (TEdit and
> TNavigator) connected via ODBC to a Postgresql 8.0 table.
>
> I've tried the earlier suggestions in various forms with no success.
>
> I again was successful in updating the table with the table containing no
> serial column. With the serial column included I get an error massage that
> the serial column needs a value.
>
> I don't understand why the serial column is generated when a row is created
> manually through Postgresql Admin interface but it doesn't generate when a
> row is added through the Delphi interface.
>
> Could someone explain this difference?
>
> Bob Pawley
>
>
> ----- Original Message -----
> From: "Bob Pawley" <rjpawley@shaw.ca>
> To: "Joshua D. Drake" <jd@commandprompt.com>
> Cc: "Frank L. Parks" <fparks@ezbizpartner.com>; "Postgresql"
> <pgsql-general@postgresql.org>
> Sent: Wednesday, May 10, 2006 3:55 PM
> Subject: Re: [GENERAL] Interface
>
>
> >Joshua
> >
> >My first try was to include it with the SQL code on the Update component.
> >It hasn't worked yet. I want to try variations.
> >
> >I am also trying a Query component which gave me the same error. I also
> >have another problem with this component giving me a cursor handle error
> >which I am attempting to solve. (Same SQL code)
> >
> >Lots of challenges for a beginner to work through.
> >
> >Bob
> >----- Original Message -----
> >From: "Joshua D. Drake" <jd@commandprompt.com>
> >To: "Bob Pawley" <rjpawley@shaw.ca>
> >Cc: "Frank L. Parks" <fparks@ezbizpartner.com>; "Postgresql"
> ><pgsql-general@postgresql.org>
> >Sent: Wednesday, May 10, 2006 3:41 PM
> >Subject: Re: [GENERAL] Interface
> >
> >
> >>Bob Pawley wrote:
> >>>Hi Frank
> >>>
> >>>Here's the code entered as part of TUpdateSQL component.
> >>>insert into p_id.p_id
> >>> (process_name)
> >>>values
> >>> (:process_name)
> >>>
> >>
> >>Did my DEFAULT not work?
> >>
> >>Joshua D. Drake
> >>
> >>
> >>>I am connected via ODBC.
> >>>
> >>>Thanks
> >>>
> >>>Bob
> >>>
> >>>----- Original Message ----- From: "Frank L. Parks"
> >>><fparks@ezbizpartner.com>
> >>>To: "Postgresql" <pgsql-general@postgresql.org>
> >>>Sent: Wednesday, May 10, 2006 12:30 PM
> >>>Subject: Re: [GENERAL] Interface
> >>>
> >>>
> >>>>Bob,
> >>>>
> >>>>Can you at least show what your insert statement looks like please?
> >>>>Also, are you using ODBC or VitaVoom's direct driver for DBExpress?
> >>>>
> >>>>Frank
> >>>>
> >>>>Bob Pawley wrote:
> >>>>
> >>>>>The folks on the Delphi forum haven't been responsive to this
> >>>>>question. Perhaps the ones that visit the forum don't know the answer.
> >>>>> I have created a Delphi interface to a Postgresql table containing a
> >>>>>serial column.
> >>>>> When I try to insert a new value through the interface I get an error
> >>>>>message that the serial field requires a value.
> >>>>> When I remove the serial column the interface inserts a new value
> >>>>>with no problem. When I insert directly via sql the serial column
> >>>>>updates automatically.
> >>>>> What am I missing to make this work through Delphi?
> >>>>> Bob
> >>>>
> >>>>
> >>>>
> >>>>---------------------------(end of
> >>>>broadcast)---------------------------
> >>>>TIP 6: explain analyze is your friend
> >>>
> >>>---------------------------(end of broadcast)---------------------------
> >>>TIP 5: don't forget to increase your free space map settings
> >>>
> >>
> >>
> >>--
> >>
> >>           === The PostgreSQL Company: Command Prompt, Inc. ===
> >>     Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
> >>     Providing the most comprehensive  PostgreSQL solutions since 1997
> >>                    http://www.commandprompt.com/
> >>
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 9: In versions below 8.0, the planner will ignore your desire to
> >>      choose an index scan if your joining column's datatypes do not
> >>      match
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

Re: Interface

From
Tony Caduto
Date:
To refresh people's memory I have a simple Delphi interface (TEdit and
>> TNavigator) connected via ODBC to a Postgresql 8.0 table.
>>
>> I've tried the earlier suggestions in various forms with no success.
>>
>> I again was successful in updating the table with the table containing no
>> serial column. With the serial column included I get an error massage that
>> the serial column needs a value.
>>
>> I don't understand why the serial column is generated when a row is created
>> manually through Postgresql Admin interface but it doesn't generate when a
>> row is added through the Delphi interface.
>>
>> Could someone explain this difference?
>>
>> Bob Pawley
>>
>>
This is a issue with the design time components and also occurs for
Interbase/Firebird Generator (same thing as a sequence)

See this google link:


http://groups.google.com/group/comp.lang.pascal.delphi.databases/browse_thread/thread/72e87907b66a6923/153daefcdf7a5d9a?lnk=st&q=delphi+interbase+grid+generator&rnum=1&hl=en#153daefcdf7a5d9a

Another one:


http://groups.google.com/group/borland.public.interbase/browse_thread/thread/dd2e2975f2119f2c/8ca7149bac382cc5?lnk=st&q=delphi+interbase+grid+generator&rnum=22&hl=en#8ca7149bac382cc5

I am assuming you are using the serial field as the PK, so you could
also set the PK property to not required as in the last link.

This is related to ODBC though, you might really want to look at Zeos or
PostgresDAC which are native delphi tdataset and have this issue taken
care of internally.
I have never had this problem with either Zeos or PostgresDAC.

Hope this helps,

--
Tony Caduto
AM Software Design
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql
Your best bet for Postgresql Administration


Re: Interface

From
Bob Pawley
Date:
Thanks Tony

I installed PostgresDAC and it cleared up the problem.

Bob


----- Original Message -----
From: "Tony Caduto" <tony_caduto@amsoftwaredesign.com>
To: "Jim C. Nasby" <jnasby@pervasive.com>
Cc: "Bob Pawley" <rjpawley@shaw.ca>; "Postgresql"
<pgsql-general@postgresql.org>
Sent: Monday, May 22, 2006 1:54 PM
Subject: Re: [GENERAL] Interface


> To refresh people's memory I have a simple Delphi interface (TEdit and
>>> TNavigator) connected via ODBC to a Postgresql 8.0 table.
>>>
>>> I've tried the earlier suggestions in various forms with no success.
>>>
>>> I again was successful in updating the table with the table containing
>>> no serial column. With the serial column included I get an error massage
>>> that the serial column needs a value.
>>>
>>> I don't understand why the serial column is generated when a row is
>>> created manually through Postgresql Admin interface but it doesn't
>>> generate when a row is added through the Delphi interface.
>>>
>>> Could someone explain this difference?
>>>
>>> Bob Pawley
>>>
>>>
> This is a issue with the design time components and also occurs for
> Interbase/Firebird Generator (same thing as a sequence)
>
> See this google link:
>
>
http://groups.google.com/group/comp.lang.pascal.delphi.databases/browse_thread/thread/72e87907b66a6923/153daefcdf7a5d9a?lnk=st&q=delphi+interbase+grid+generator&rnum=1&hl=en#153daefcdf7a5d9a
>
> Another one:
>
>
http://groups.google.com/group/borland.public.interbase/browse_thread/thread/dd2e2975f2119f2c/8ca7149bac382cc5?lnk=st&q=delphi+interbase+grid+generator&rnum=22&hl=en#8ca7149bac382cc5
>
> I am assuming you are using the serial field as the PK, so you could also
> set the PK property to not required as in the last link.
>
> This is related to ODBC though, you might really want to look at Zeos or
> PostgresDAC which are native delphi tdataset and have this issue taken
> care of internally.
> I have never had this problem with either Zeos or PostgresDAC.
>
> Hope this helps,
>
> --
> Tony Caduto
> AM Software Design
> http://www.amsoftwaredesign.com
> Home of PG Lightning Admin for Postgresql
> Your best bet for Postgresql Administration
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings