Fresh installation of Drupal on PostgreSQL generates some annoying SQL warnings while browsing the administrative section:

warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near ")" at character 84 in /mnt/(.....)/html/includes/database.pgsql.inc on line 138.
warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key violates unique constraint "menu_router_pkey" in /mnt/(.....)/html/includes/database.pgsql.inc on line 138.
user warning: query: INSERT INTO menu_router (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, type, block_callback, description, position, weight, file) VALUES ('search', '', '', 'user_access', 'a:1:{i:0;s:14:"search content";}', 'search_view', 'a:0:{}', 1, 1, '', 'search', 'Search', 't', '', 20, '', '', '', 0, 'modules/search/search.pages.inc') in /mnt/(.....)/html/includes/menu.inc on line 2249.

PHP 5.2.2, Apache 2, Linux (Debian), PostgreSQL 7.4.7

Comments

linuxpoet’s picture

I would suggest that you drop support for 7.4 as of Drupal 6. PostgreSQL 7.4 is coming up on 5 years old now and doesn't support nearly the scalability or performance of the 8 series.

jaydub’s picture

Well the error report above would indicate that the query failure is not because of any problem in the syntax of the SQL but rather that the INSERT should not have been called at all...

warning: pg_query() [function.pg-query]: Query failed: ERROR: duplicate key violates unique constraint "menu_router_pkey" in /mnt/(.....)/html/includes/database.pgsql.inc on line 138.

The unique constraint menu_router_pkey is the name of PRIMARY KEY for the menu_router table which is on the 'path' column. So this error would indicate that there is already a row in menu_router for the path of 'search'.

Can you make sure and empty your drupal caches and try to recreate the issue? Can you try on on the Drupal 6 (or 6.1) release?

alek123’s picture

Version: 6.0-rc2 » 6.9
Issue tags: +PostgreSQL

This issue occured to me many times with PostgreSQL, the main reason is when I'm installing or uninstalling some module, and mean while I try to navigate to other pages with the same open seasson.

1) Install some module and save
2) While the page is loading, try to navigate in another window with the same user. You see that if the first page don't finish to load, the second one neither.
3) Then this error shows up.

It's annoying but don't brake anything at all.

Alek

AlexisWilke’s picture

Title: SQL Query failed on PostgreSQL 7.4 » SQL Query failed on PostgreSQL 8.3
Version: 6.9 » 6.20

Just noticed today that whenever I reset my menus I get this error with Drupal 6.20 and Postgresql 8.3.

It doesn't otherwise seem to cause problems, but that explains why that task is so very slow (since it generates more than 10 pages of errors!)

Thank you.
Alexis Wilke

interestingaftermath’s picture

subscribe

dgv’s picture

I had noticed these errors with 6.11 and postgres 8.3. The cause I've figured is that menu_rebuild() was called simultaneously by two different php instances, and since each one was inserting similar data in the menu_router table, for each couple of identical INSERTs there was only one INSERT that could succeed, while the other was sure to fail with a unique constraint violation.

But with 6.20+ these errors would be expected to be gone, since menu_rebuild() now starts with lock_acquire('menu_rebuild'), which looks very much like it's supposed to prevent concurrent runs...

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.