phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] db insertion problems with pgsql


From: Mij
Subject: Re: [Phpgroupware-developers] db insertion problems with pgsql
Date: Tue, 20 Jan 2004 20:04:06 +0100

Il giorno 20/gen/04, alle 18:56, Chris Weiss ha scritto:

please take care that replies stay on the list...

my requests for quick & dirty fixes does not probably interest
archives or other people


I think the "right" way is to not use '' for numbers, but use data validation
and put 0's or nulls where they need to be.

0 is actually what i proposed. nulls are not allowed at the moment. You must
change the db definition if you choose this way.
null are sure a better way, and actually i don't understand why it didn't use them so far. '' doesn't mean anything. null covers explicitly "not known" values. moreover, it didn't only not use 'null' in place of '', but it explicitly imposes
"not-null" values.
this is really strange, but maybe the author didn't projected it at all.


The fix will be released, in .16 which will be final very soon now, and is mostly stable for production. If you are doing a new install I recomend going with .16RC2 with cvs update so you don't have to upgrade again in another 2
weeks to be current.

i'm quite in a hurry, so I'm gonna use the rc as you recommend.
thanks


Mij (address@hidden) wrote:

the fix won't be released, ok.
could you anyway post to me a quick and
dirty solution to that?
at least some approach like to stupid one
i used ( '' -> '0' ). If you used '' as correct
internal representation, this would probably
be a "don't care", then this wouldn't even be
a too dirty solution.

thanks


Il giorno 20/gen/04, alle 15:46, Chris Weiss ha scritto:

another one caused by pg changing their default behaviours :/

Although '' is legal in sql, its behaviour varys from db to db.
Bookmarks is
not a very used app so I'm not surprized that no one has found this
bug until
now.  It won't likely be fixed in .14, but if it's still a problem in
.16 it
will be, and may very well already have been.

Mij (address@hidden) wrote:

hi

i will report a twofold problem here with
phpgw+bookmark app (phpgwapi).

i'm not experienced on php, so be soft with it.
I get this error from phpgw-0.9.14.007, from
freebsd ports, on a freebsd 4.9 machine
with pgsql 7.4.1.

that's the output when trying to *reach the "bookmarks"
page*:


------
Database error: Invalid SQL: INSERT INTO phpgw_categories (
cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description ,c
at
_data,cat_main,cat_level) VALUES ( '0','4','','bookmarks','No
category','','','','')
PostgreSQL Error: 1 (ERROR: invalid input syntax for integer: "" )

File:
/usr/local/www/data-dist/phpgroupware/phpgwapi/inc/
class.categories.inc.php
Line: 515

Session halted.Template Error: loadfile: body is not a valid handle.
Halted.Template Error: loadfile: body is not a valid handle.
Halted.Template Error: loadfile: body is not a valid handle.
[...]
-------

then php killed for memory slot exhaustion.
The incrimiated line:

$this->db->query("INSERT INTO phpgw_categories ($id_col
cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description ,c
at
_data,"
                                 . "cat_main,cat_level) VALUES
($id_val
'" . $cat_values['parent'] . "','" . $this->account_id . "','" .
$cat_values['acc
ess']
                                 . "','" . $this->app_name . "','" .
$cat_values['name'] . "','" . $cat_values['descr'] . "','" .
$cat_values['data']
                                 . "','" . $cat_values['main'] .
"','" .
$cat_values['level'] . "')",__LINE__,__FILE__);


but I think the php output is more interesting.

I don't know your internal representation. Maybe it's valid for you,
but the thing anyway is that $cat_values['access'] seems not to be set
to a valid value. This causes a type error by the dbms.

however, I tried to manually insert a line of that kind, replacing the
invalid '' with nulls.
The table does not permit any null. I tried with zeroes then, in place
of ''. It works this way.
I can reach the page, and push new bookmarks with the form.


even with this, anyway, there's a second problem. I get errors even on
the preferences page,
when trying to create new categories. The error is more polite this
time:

-------------
Database error: Invalid SQL: INSERT INTO phpgw_categories (
cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description ,c
at
_data,cat_main,cat_level) VALUES (
'7','4','public','bookmarks','foo','bar','N;','','1')
PostgreSQL Error: 1 (ERROR: invalid input syntax for integer: "" )

File:
/usr/local/www/data-dist/phpgroupware/phpgwapi/inc/
class.categories.inc.php
Line: 515

Session halted.
-------------

Same problem. Same solution: manually insert replacing '' with '0'.
The entry inserted is listed, but I still can't create new entries
from
the web interface.


as said, I don't know php. Unfortunately, i don't even have time to
spend on this
problem right at the moment, and at the same time i'd also need this
interface working.
any collaboration will be appreciated.

bye



_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/phpgroupware-developers




_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/phpgroupware-developers






_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/phpgroupware-developers






reply via email to

[Prev in Thread] Current Thread [Next in Thread]