Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Gossamer doesn't work with newer postgres

Quote Reply
Gossamer doesn't work with newer postgres
It appears that newer postgres (7.3.4 at least and up) no longer let you specify '' for a value when inserting a row -- the contents must be NULL. Can someone please look into this?
--jaga
Quote Reply
Re: [jaga] Gossamer doesn't work with newer postgres In reply to
I'm testing with PostgreSQL 7.4.2, and it _does_ allow '' (empty string) in not null fields. However, GT::SQL will _not_ allow this as it isn't supported on certain databases which GT::SQL needs to support. If you want to be able to add an empty string for a value, you should change the column to not be 'not null'.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com

Last edited by:

Jagerman: Jun 23, 2004, 11:56 AM
Quote Reply
Re: [Jagerman] Gossamer doesn't work with newer postgres In reply to
Sorry, in retrospect I wasn't too clear. It seems to for fields of type integer with the restriction: not null default 'N' (where N is an integer), '' does not trigger the default to be inserted. What happens is the pg_atoi fails because '' is not a valid ascii string in which to turn into an integer. Does that clarify?
--jaga

p.s. Apperantly I'm also posting in the wrong forum, since I'm using gforums 1.2.3

Last edited by:

jaga: Jun 23, 2004, 12:16 PM
Quote Reply
Re: [jaga] Gossamer doesn't work with newer postgres In reply to
This isn't (entirely) specific to pg - the same query in mysql will insert a 0, not the default value for the column. Is this causing a problem?

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Gossamer doesn't work with newer postgres In reply to
Yes it is a problem. It is preventing me from creating any forums. When the application tries to create a forum and is inserting records into the gforum_forum table,it is often sending '' as the value for fields of type integer with the 'restriction' not null default 2. So, the app tries to insert '' for this, which I can only assume is intended to get the default. I can create groups fine, but not a single forum.
--jaga
Quote Reply
Re: [jaga] Gossamer doesn't work with newer postgres In reply to
Here are the specifics:

Quote:
GT::SQL::Driver::PG::sth (30384): Executing query: INSERT INTO gforum_Forum (forum_total_threads,forum_last_poster,forum_total,forum_allow_attachments,forum_name,forum_allow_user_edit,forum_attachment_max_size,forum_attachments,forum_last_id,forum_sort_rank,forum_style,forum_move_pointer,forum_allow_guest_attachments,forum_new_timeout,forum_attachment_inline,cat_id_fk,forum_hard_delete,forum_desc,forum_edit_timeout,forum_last,forum_id) VALUES (0,'',0,1,'asdsa',3,307200,'','',0,1,1,1,90,1,2,2,'asd','','',NEXTVAL('gforum_Forum_seq')) from GForum::Table::Forum::_plg_add at GForum::Table::Forum::_plg_add line 131

GT::SQL::Table (24562): Failed to execute query: 'INSERT INTO gforum_Forum (forum_total_threads,forum_last_poster,forum_total,forum_allow_attachments,forum_name,forum_allow_user_edit,forum_attachment_max_size,forum_attachments,forum_last_id,forum_sort_rank,forum_style,forum_move_pointer,forum_allow_guest_attachments,forum_new_timeout,forum_attachment_inline,cat_id_fk,forum_hard_delete,forum_desc,forum_edit_timeout,forum_last,forum_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NEXTVAL('gforum_Forum_seq'))' Reason: ERROR: pg_atoi: zero-length string at /var/www/systems2/perl/admin/GT/SQL/Driver/PG.pm line 536.

and the table structure (as i'm sure you already know):
Code:
gforum=> \d gforum_forum
Table "public.gforum_forum"
Column | Type | Modifiers
-------------------------------+-----------------------+-----------------------
forum_id | integer | not null
cat_id_fk | integer | not null
forum_name | character varying(50) | not null
forum_desc | text |
forum_total | integer | not null default '0'
forum_total_threads | integer | not null default '0'
forum_last | integer |
forum_last_poster | character varying(50) |
forum_last_id | integer |
forum_sort_rank | integer | not null default '0'
forum_style | smallint | not null default '1'
forum_allow_attachments | smallint | not null default '1'
forum_allow_guest_attachments | smallint | not null default '1'
forum_attachments | integer |
forum_attachment_max_size | integer | default '307200'
forum_attachment_inline | integer | default '1'
forum_allow_user_edit | smallint | not null default '3'
forum_edit_timeout | integer |
forum_hard_delete | smallint | not null default '2'
forum_new_timeout | integer | not null default '90'
forum_move_pointer | smallint | not null default '1'
Indexes: gforum_forum_pkey primary key btree (forum_id),
gforum_gforum_forumf_c btree (cat_id_fk)



Hope this helps shed light on what i'm talking about. This is pretty important to me because i'll be purchasing licenses for a number of websites shortly [after this test is successful], and we intend to run this with a postgres backend.
--jaga
Quote Reply
Re: [jaga] Gossamer doesn't work with newer postgres In reply to
FYI: I've contacted support and they have supplied me with an update PG.pm that 'works' with postgres 7.3