Insert query does not work on postgres db

robin t - January 4, 2008 - 19:28
Project:Table Manager
Version:5.x-1.4
Component:Code
Category:bug report
Priority:critical
Assigned:robin t
Status:closed
Description

The tablemanager does not work on a postgres db because the insert queries tries to set the tid and id fields (which are of type serial) to ''.

Solution is to omit the tid and id fields in the query and rely on the default value. Though untested, it should also work on a mysql db.

- db_query("INSERT INTO {tablemanager_data} (id, tid, uid, data, format) VALUES ('', %d, %d, '%s', %d)", $form['tid'], $user->uid, $row, $form['format']);
+ db_query("INSERT INTO {tablemanager_data} (tid, uid, data, format) VALUES (%d, %d, '%s', %d)", $form['tid'], $user->uid, $row, $form['format']);

- db_query("INSERT INTO {tablemanager} (tid, uid, name, description, header) VALUES ('', %d, '%s', '%s', '%s')", $user->uid, $name, $desc, $row);
+ db_query("INSERT INTO {tablemanager} (uid, name, description, header) VALUES (%d, '%s', '%s', '%s')", $user->uid, $name, $desc, $row);

AttachmentSize
tablemanager.module.patch1.38 KB

#1

pobster - May 27, 2008 - 08:07

Apologies, first time I've read this issue - not sure how I've missed it before? Anyways... I'll alter it in the 6.x branch if the bug is still present (I've no idea off the top of my head), it'll get backported to 5.x when it's in a more complete state.

Pobster

#2

pobster - August 25, 2009 - 16:53
Status:reviewed & tested by the community» closed
 
 

Drupal is a registered trademark of Dries Buytaert.