Download & Extend

Insert query does not work on postgres db

Project:Table Manager
Version:5.x-1.4
Component:Code
Category:bug report
Priority:critical
Assigned:robin t
Status:closed (fixed)

Issue Summary

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

Comments

#1

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

Status:reviewed & tested by the community» closed (fixed)
nobody click here