When performing an upgrade you have incorrect syntax for PostgreSQL Database.
During an upgrade you get pink text displaying:
Drupal database update
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "EXISTS" at character 19 in /var/www/www.cerwinvega.com/live/includes/database.pgsql.inc on line 139.
* user warning: query: DROP AGGREGATE IF EXISTS first(anyelement) in /var/www/www.cerwinvega.com/live/sites/all/modules/views/views.install on line 294.
The following queries were executed
views module
Update #6007
* CREATE OR REPLACE FUNCTION first(anyelement, anyelement) RETURNS anyelement AS 'SELECT COALESCE($1, $2);' LANGUAGE 'sql';
* Failed: DROP AGGREGATE IF EXISTS first(anyelement)
* CREATE AGGREGATE first(sfunc = first, basetype = anyelement, stype = anyelement);
Comments
Comment #1
alek123 commentedIdem...
Comment #2
mauritsl commentedAlso happens on a new installation (Drupal 6.16 on Postgres 8.1):
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "EXISTS" at character 19 in /var/www/vhosts/maudev/includes/database.pgsql.inc on line 139.
* user warning: query: DROP AGGREGATE IF EXISTS first(anyelement) in /var/www/vhosts/maudev/sites/all/modules/contrib/views/views.install on line 14.
Comment #3
merlinofchaos commentedThis isn't really critical. I don't think it impacts functionality at all.
Comment #4
mauritsl commentedI indeed didn't notice any impact. Views is just working fine as far as I see, it was just the error showing.
Comment #5
iamjon commentedmbukaty,
does the error occur in the latest version of views?
Assigning this to dereine
Comment #6
dawehnerCan someone here provide a proper syntax for pgsql?
Comment #7
real_ate commentedI can confirm that this error is still shown with: Drupal core 6.19, Views 6.x-2.11 and postgresql-server 8.1.22
To recreate:
1) Install a clean drupal with postgresql.
2) Go to Administer > Site Building > Modules > List and enable Views.
3) After clicking "save configuration" you get the following message:
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "EXISTS" at character 19 in /path/to/site/includes/database.pgsql.inc on line 139.
* user warning: query: DROP AGGREGATE IF EXISTS first(anyelement) in /path/to/site/sites/all/modules/views/views.install on line 14.
I have done some investigation into this issue and it seems like there will be no way to conditionally delete the aggregate without installing the plpgsql into the drupal database for versions < 8.2.
The only thing that I would suggest (if you want to support version 8.1) would be to remove the "IF EXISTS" part and suppress any errors from the following command:
@db_query("DROP AGGREGATE first(anyelement)");
This will actually drop the AGGREGATE if it exists and will not warn the user if it does not.
Comment #8
iamjon commentedAdding tag
Comment #9
liam morlandTagging
Comment #10
mustanggb commentedComment #11
liam morlandShould this instead be "Closed (outdated)"?
Comment #12
mustanggb commentedPossibly, I only went with won't fix because D6 isn't really getting commits.
Comment #13
liam morlandClosed (outdated) is designed for that:
https://www.drupal.org/node/156119#outdated