CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Autoincrement & PostgreSQL -> problems inserting

Print topic Send  topic

Author Message
Teufel
Posted: 01/24/2002, 9:27 PM

Hi!

I am having a really hard time trying to get insert forms to work with PostgreSQL. I have to specify the primary key in the form (as a hidden field), but then I always get the following error:

Warning: PostgreSQL query failed: ERROR: ExecAppend: Fail to add null value in not null attribute usr_pk in /usr/local/etc/httpd/vhosts/vespermy/db_pgsql.inc on line 67
Database error: Invalid SQL: insert into scp_usuarios (user_pk,user_first_name,user_last_name,user_email,user_login,user_pass,user_level) values (NULL,'John','Smith','john@aaa.com','john_login','john_password',1)
PostgreSQL Error: 1 (ERROR: ExecAppend: Fail to add null value in not null attribute user_pk )
Session halted.

I can imagine two solutions:

1) Somehow make CodeCharge STOP specifying the primary key in the insert command, since this number will be generated automatically ???

2) Get the next value of the sequence in PostgreSQL before inserting the data, but this is dumb, since the purpose of the "auto-increment" is exactly this!

TIA,
Teufel
Tony Tomov
Posted: 01/25/2002, 12:21 AM

Since the field is autonum,
you do not need to include that field
in the form.

You have two possibilities:

1. Do not include the field in the form (delete them)
This way the field will be not included in the insert command,
which is typpical for such fields.

2. Mark a field as Label if you wan to dispaly them in the screen.
This will inclide the field, but not in the insert command.

Regards
Tony
Tony Tomov
Posted: 01/25/2002, 12:26 AM

Sorry for confusion.

The first is not true.
You can use a hidden field in the form,
but in the Input tab unmark the Required and transfer check boxes.

Regards
Tony

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.