Notice: Array to string conversion in InsertQuery_pgsql->execute() (line 43 of /var/www/sites/xxxxx/drupal-7.0/includes/database/pgsql/query.inc).

Seems to work, but errors out with the above.

CommentFileSizeAuthor
#10 1055774.patch2.35 KBjohn morahan

Comments

himerus’s picture

Interesting,

I definitely may have taken some query shortcuts that would cause this, but I think (in the latest version) that all the queries are gone (some functionality removed and pushed over into the Omega theme itself).

I'll have to dig around, and see if I can locate where this would happen in the module.
If you can provide more info on where it might be occurring, that would help too!!

tresero’s picture

I am trying to find out where, but it is not that easy!

ogi’s picture

Sometimes I'm seeing this too.

sbuttgereit’s picture

This is really tough to unwind! I get this bug as well: I get the error exactly 14 times in a row. Everything seems to work, but it is unnerving.

I've been doing a bit of digging and I know that the first instance of the 14 errors is this:

Array ( [0] => _omega_tools_theme_reset ) Table: menu_router with values 1 is Array!

Since I'm in a development environment, I simply added:

is_array($insert_values[$idx]) ? die("Table: ".$this->table." with values ".print_r($insert_values[$idx])." is Array!") : null;

to the drupal-7.2/includes/database/pgsql/query.inc code right before where it throws the error.

It looks like this originating in the omega_tools.module file in the hook_menu implementation (function omega_tools_menu()):

'page callback' => array('_omega_tools_theme_reset'),

I could be very wrong and and may just not know enough about the internals of Drupal, but that's what it looks like to me.

Thanks,
Steve

sbuttgereit’s picture

As an aside, I tested changing:

'page callback' => array('_omega_tools_theme_reset'),

in omega_tools.module to:

'page callback' => '_omega_tools_theme_reset',

And the complete string of 14 errors went away, delightfully replaced with, "The configuration options have been saved". I think that was it; I cannot say that I've tested for any resulting regressions, but based on the documentation I've seen this should be a pretty standard implementation.

Cheers!

Steve

tresero’s picture

I don't believe that works,
I get:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'Array' not found or invalid function name in menu_execute_active_handler() (line 503 of /var/www/sites/dev.mayuli.com/drupal/includes/menu.inc).

2 times in a row

tresero’s picture

Version: 7.x-2.0-beta7 » 7.x-3.0-rc1
Priority: Normal » Major

I just uninstalled and reinstalled on a new installation of Drupal 7, this is still an issue in 7.x-3.0-rc1

The only difference is the error line number:

Notice: Array to string conversion in InsertQuery_pgsql->execute() (line 42 of /var/www/sites/dev.mayuli.com/drupal/includes/database/pgsql/query.inc).

fubhy’s picture

Status: Active » Postponed (maintainer needs more info)

Try the latest dev version.

sbuttgereit’s picture

Version: 7.x-3.0-rc1 » 7.x-3.0-rc3

I am doing an update to 7.x-3.0-rc3 and I ran into the...

Notice: Array to string conversion in InsertQuery_pgsql->execute() (line 42 of /var/www/sites/dev.mayuli.com/drupal/includes/database/pgsql/query.inc)

problem as well. Based on my testing it is for the same root cause as I posted before. The code for PostgreSQL in query.inc is not tolerant of the page_callback values in omega_tools.module/function omega_tools_menu() being set to arrays; setting the assignment to a simple string makes it work in my environment.

I found the same problem with access_callback values as well. Here there was an inconsistency in that some instances of access_callback were already being set as simple strings and there was one, however, ('access callback' => array('_omega_tools_theme_access')) that also caused a problem.

When I look at the Drupal API for hook_menu (for which omega_tools_menu is an implementation), they document page_callback not being set with an array, but a string. The suggestion to check out the dev code was prior to rc3 which I'm using... I looked at the code in the most recent dev branch and it looks like this will likely be a problems still.

I speculate that this is happening because PostgreSQL can be less forgiving about typing mis-matches than other open source databases. The underlying table (menu_router) has the page_callback and access_callback columns as 'character varying' rather than arrays of 'character varying'. If Drupal's abstraction layer tries to respect the array and passes it as such to the database, the database would at least warn on the problem if not error outright. Again, I've not got through database logs to figure out what's happening there... but for me at least changing the page_callback's and access_callback's seem to get rid of the errors for me.

If desired, I can post a patch.

john morahan’s picture

Title: Postgres incompatibility » Postgres and SQLite incompatibility
Version: 7.x-3.0-rc3 » 7.x-3.x-dev
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.35 KB

You're quite right sbuttgereit, all the page and access callbacks should be strings and not arrays. This causes errors in SQLite too. I'm surprised it even works in MySQL to be honest.

barraponto’s picture

Status: Needs review » Reviewed & tested by the community

This patch has been tested in #1263664: SQL error on module install and by myself, works fine.

fubhy’s picture

Status: Reviewed & tested by the community » Fixed

Commited. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -PostgreSQL

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