Warning pg_query
| Project: | Blog Theme |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
I installed drupal, for Multiple user, but warning error is show up :
* warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for integer: "" in /home/xxx/drupal-6.8/includes/database.pgsql.inc on line 139.
* user warning: query: SELECT n.nid, n.type, n.language, n.uid, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, n.tnid, n.translate, r.vid, r.uid AS revision_uid, r.title, r.body, r.teaser, r.log, r.timestamp AS revision_timestamp, r.format, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.nid = '' in /home/xxx/drupal-6.8/modules/node/node.module on line 749.

#1
#2
error show up when I install blogtheme
#3
#4
I'll try to have a look at this issue soon. Do you have a suggested fix?
#5
Yes .. I did not know about drupal code ( newbie in here :D )
but I know little bit know about php and postgreSQL.
I hacked node.module ( I dunno this is wise option or not :D ), now the error warning is gone.
I add simple code to replace null value with 0.
I suggest this because I used PostgreSQL not Mysql and they have different way to look at null value.
#6
blogtheme does not have a single SQL query, so this module cannot be responsible.
Hacking Drupal core is never a wise thing to do ;) Be careful!
Could you investigate the issue further and reassign this issue to the proper module?
#7
Ok, ... I'll try to learn on it :D ..
Found it !! on case "node"
the if $nid value is_null then Prostgres don't like it, because it ilegal !!, nid is INT NOT NULL, so I add checking not null value for $nid if yes give it 0 instead not hull.
Here portion of blog_theme.module, I add smal code on below $nid = arg(1)
case 'node':
$nid = arg(1);//check if $nid is_null, give it 0 instead null
if ( !isset ($nid)) $nid=0;
#8
#9
Thanks for investigating the problem and finding the cause. It's very helpful.
Node $nid = 0 does not exist. If $nid is NULL then there is no reason to proceed. Try the attached patch, instead.
See this: http://drupal.org/patch
Since you say you are a newbie with Drupal, here are a couple of advice which will help you to communicate better with module maintainers:
1) On an issue, edit your own comment only to fix typos. Add additional information in a new comment. The practical reason for this is that we are subscribed to the issue and receive email notifications. In this case, the email I received when you posted #7, only had the text
Ok, ... I'll try to learn on it :D ... If you hadn't posted #8, I wouldn't have come back online and wouldn't have seen the additional very useful and relevant information.2) In your original report, there is one key information missing: how to reproduce the bug. It is always VERY helpful to have a step by step instructions to reproduce the bug. It helps to find which part of the code is involved.
The attached patch should solve the issue. Thanks for the feedback.
#10
OK thanks for advices :D
At first post I dunno what causing error I enabled many modules, after that I try to check it one by one. So I post the #2.
Thanks
#11
Don't close yet. I haven't committed the fix.
#12
Something wrong ?
blog@wwwserv2:~/web$ patch -p0 < pgsql-warning-at-node.patch
can't find file to patch at input line 8
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: blog_theme.module
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/blogtheme/blog_theme.module,v
|retrieving revision 1.20.2.8
|diff -u -p -r1.20.2.8 blog_theme.module
|--- blog_theme.module 30 Sep 2008 08:58:26 -0000 1.20.2.8
|+++ blog_theme.module 6 Jan 2009 13:20:14 -0000
--------------------------
File to patch:
#13
Ok done, The patch must on module directory, cannot do on drupal root directory, the problem was fix using your patch :D. Here the web, http://blog.akprind.ac.id,
#14
Thanks for the feedback.
Usually Drupal core patches are applied from the Drupal root directory, but contrib module patches are applied from within their own directory.
I have committed the fix in HEAD and D6. D5 didn't need this.
I'll set this issue as fixed when I have made a new release: #355440: Make new D5 and D6 releases.