Provides various official and user-released code examples and code reference. You are welcome to exchange and learn some problems that may occur when using pgsql in TP. A solution is provided for your reference.
1. The add () method cannot obtain the new primary key value. Modify row 134 of pgsql DRIVER: Db. Pgsql. class. php:
list($last_insert_id) = pg_fetch_array($result,null,PGSQL_ASSOC);
After testing, the value of the new ID is not assigned to $ last_insert_id, so it is changed
$last_insert = pg_fetch_array($result,null,PGSQL_ASSOC);
Change return:
return $last_insert['insert_id'];
2. Errors Caused by the keyword pgsql in SQL:
①: RBAC. class. php
User is the keyword of pgsql, And in this RBAC. class. the SQL statement in php contains a user, causing an SQL error. Therefore, change 'user' in the four SQL statements in this file to 'users ', then, the following rows of 214 rows, 227 rows, 240 rows, and 258 rows are added:
$table['user']." as user,".
Change
$table['user']." as users,".
②: The SQL statement in the view model is incorrect:
SELECT COUNT(*) AS tp_count FROM tp_user User
Or because user is the keyword of pgsql;
Correction Method: Rename the user table to users or other
In short, when the PostgreSQL keyword appears in SQL, you should pay attention to it,
Keywords such as user and group cannot be used for data table names, field names, and field aliases.
In addition, the not null field in pgsql does NOT allow null values to be inserted, but in mysql, it is acceptable. Be sure to pay attention to this. If you are NOT careful, it will lead to an SQL syntax error.
Other bugs are being searched
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB