After install current drupal 7 cvs and some config it, i'm try to add book page and get PDO error:

PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "": SELECT revision.timestamp AS revision_timestamp, revision.uid AS revision_uid, revision.vid AS vid, revision.title AS title, revision.log AS log, revision.status AS status, revision.comment AS comment, revision.promote AS promote, revision.sticky AS sticky, base.nid AS nid, base.type AS type, base.language AS language, base.uid AS uid, base.created AS created, base.changed AS changed, base.tnid AS tnid, base.translate AS translate FROM {node} base INNER JOIN {node_revision} revision ON revision.vid = base.vid WHERE (base.nid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => ) in DrupalDefaultEntityController->load() (line 122 of /home/vase/www/dev.selfip.ru/includes/entity.inc).

CommentFileSizeAuthor
#8 node_needs_a_nid_for_contextual_links.patch570 byteschx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Interesting. It is trying to load a node with nid = ''?

lotyrin’s picture

Subscribe. I've set up a test environment with PostgreSQL on Ubuntu 10.4 and CVS HEAD, running tests now. If they all pass I'll try to reproduce the issue by hand.

vase’s picture

Today i'm upgrade php (i like to test some new features :). Before i have php 5.3. Now i have php 5 - svn.
My phpinfo if this matter - http://dev.selfip.ru/phpinfo.php. If needed, i can provide additional info..
May be this is because i check preview is mandatory before post content. May be in this step drupal have not node id ?

vase’s picture

Sorry, i'm recheck drupal version - i'm use 7.x-dev, not CVS. But when i'm upgrade to cvs version - problem still exists.

Berdir’s picture

Ok, I am able to reproduce this with any node type.

This goes back to contextual links, which tries to generate an link with the name "node/", the menu system then calls node_load() with an empty string and so it fails..

Not sure where this should be fixed, entity system, menu system, contextual links module, ... ?

Shortened stack trace:

#0  DrupalDefaultEntityController->load(Array ([0] => ), Array ()) called at [/home/berdir/Projekte/d7/drupal/includes/common.inc:6503]
#1  entity_load(node, Array ([0] => ), Array (), ) called at [/home/berdir/Projekte/d7/drupal/modules/node/node.module:851]
#2  node_load_multiple(Array ([0] => ), Array (), ) called at [/home/berdir/Projekte/d7/drupal/modules/node/node.module:870]
#3  node_load() called at [/home/berdir/Projekte/d7/drupal/includes/menu.inc:545]
#4  _menu_load_objects(Array ([path] => node/%, ...
#5  _menu_translate(Array ([path] => node/% ....
#6  menu_get_item(node/) called at [/home/berdir/Projekte/d7/drupal/includes/menu.inc:1907]
#7  menu_contextual_links(node, node, Array ([0] => )) called at [/home/berdir/Projekte/d7/drupal/modules/contextual/contextual.module:122]
#8  contextual_links_view(Array ([#pr....
#9  contextual_preprocess(Array ([nid] => ,[vid] => ,[uid] => 1,[create....
...
#20 node_add(article)
vase’s picture

ping

vase’s picture

Priority: Normal » Critical
chx’s picture

Status: Active » Needs review
FileSize
570 bytes

Um. Seriously. Dudes. Noone patched this? What on earth, it's trivial.

Berdir’s picture

Component: node.module » contextual.module
Status: Needs review » Reviewed & tested by the community

I planned to do so but got distracted into other PostgreSQL issues yesterday :)

The patch looks good and I verified that it fixes the problem. I guess a test would be nice but contextual.module does not have any tests yet (because it depends heavily on JS I assume) so this simple bugfix shouldn't be punished because of that :)

Berdir’s picture

Title: drupal CVS and postgresql => create node error » contextual module calls menu_get_item() for unsaved nodes, resulting in pdo exception on postgresql

Better title...

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

David_Rothstein’s picture

Title: contextual module calls menu_get_item() for unsaved nodes, resulting in pdo exception on postgresql » The node module tries to attach contextual links to unsaved nodes, resulting in pdo exception on postgresql
Component: contextual.module » node.module

Minor issue queue cleanup: Seems like this was a pure node module bug, wasn't it (only indirectly related to contextual.module).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Liam Morland’s picture