By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,502 Members | 1,186 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,502 IT Pros & Developers. It's quick & easy.

Insert question null/not null serial, etc.

P: n/a
I downloaded the port for Postgres for PHP-NUKE.

All insert statements are as follows:

For table:
Table "nuke_referer"
Column | Type | Modifiers
--------+------------------------+----------------------------------------------------------
rid | integer | not null default
nextval('"nuke_referer_rid_seq"'::text)
url | character varying(100) | not null default ''
Primary key: nuke_referer_pkey
insert into nuke_referer values (NULL,'whatever');

Which gives me the error: "Warning: pg_exec(): Query failed: ERROR:
ExecAppend: Fail to add null value in not null attribute rid"

Since nowhere in the 3000 files of PHP-Nuke do they actually name columns
for insert commands, does anyone have any suggestions? Can NULL be
replaced with anything? (Keep in mind I'd like something I can globally
change, naming tables/columns individually is out of the question.)
--
[ Russ Schneider (a.k.a. Sugapablo) ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ su*******@12jabber.com <--jabber IM ]

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sat, Jan 31, 2004 at 04:56:58PM -0500, Russ Schneider wrote:
insert into nuke_referer values (NULL,'whatever');

Which gives me the error: "Warning: pg_exec(): Query failed: ERROR:
ExecAppend: Fail to add null value in not null attribute rid"

Since nowhere in the 3000 files of PHP-Nuke do they actually name columns
for insert commands, does anyone have any suggestions? Can NULL be
replaced with anything?


Try DEFAULT. It will work on some cases if the NULL value was intended
to insert the default value, but will of course fail otherwise.

I wonder how much confidence you do have on a "port to Postgres" that
doesn't even actually work. You'll probably have lots of more work to
do to make it run, let alone be efficient.

Also, hasn't PHP Nuke had lots of security problems? Somebody else may
be able to suggest a better alternative ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Find a bug in a program, and fix it, and the program will work today.
Show the program how to find and fix a bug, and the program
will work forever" (Oliver Silfridge)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #2

P: n/a
Russ Schneider <ru**@sugapablo.com> writes:
insert into nuke_referer values (NULL,'whatever'); Which gives me the error: "Warning: pg_exec(): Query failed: ERROR:
ExecAppend: Fail to add null value in not null attribute rid"
Sounds like they are expecting NULL to get replaced with the column
default, which is shall we say a rather surprising reading of the SQL
spec (and yeah, I know which other database acts that way).
Since nowhere in the 3000 files of PHP-Nuke do they actually name columns
for insert commands, does anyone have any suggestions? Can NULL be
replaced with anything?


In the last PG release or two you could write DEFAULT instead of NULL
and get the desired behavior.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.