Problem/Motivation

Drupal's installer depends on the on-demand cache table creation system. The current behavior is to generate queries that are expected to fail (and break if transactions were explicitly committed). Drupal will be successfully installed, but it will appear that something went wrong, and if something did go wrong, it might not be apparent to the end user.

This causes PostgreSQL's error log to spam messages about non-existing tables:

2021-09-20 18:14:49.710 UTC [71] ERROR:  relation "config" does not exist at character 20                                                                            
2021-09-20 18:14:49.710 UTC [71] STATEMENT:  SELECT "data" FROM "config" WHERE "collection" = '' AND "name" = 'core.extension'                                       
2021-09-20 18:14:49.711 UTC [71] ERROR:  relation "config" does not exist at character 20                                                                            
2021-09-20 18:14:49.711 UTC [71] STATEMENT:  SELECT "data" FROM "config" WHERE "collection" = '' AND "name" = 'system.site'

Steps to reproduce

  1. Tail PostgreSQL logs (a docker container using "postgres" image will output this by default)
  2. Go to /core/install.php
    • Errors above are present
  3. Continue until Drupal is "installing"
    • "Relation does not exist" errors will continue to spam the postgresql log

Related issues:

#1025314: Transactions should be allowed to be committed explicitly
#2371709: Move the on-demand-table creation into the database API
#2356105: [meta] Refactor the installer
#1530756: [meta] Use a proper kernel for the installer

Proposed resolution

TBD

Remaining tasks

Decide if this is a support task and should be closed as a duplicate or works as designed.
If not, then add tasks.

API changes

TBD

CommentFileSizeAuthor
Pgsql_log.txt510.82 KBjhmnieuwenhuis
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhmnieuwenhuis created an issue. See original summary.

cilefen’s picture

Title: Database errors in log during installation » "Error: relation x does not exist" logged by PostgreSQL server during installation
cilefen’s picture

I posted a comment on #2001350: [meta] Drupal cannot be installed on PostgreSQL linking this issue.

mradcliffe’s picture

Issue tags: -install postgresql +PostgreSQL

Is there a specific error that is preventing you from installing Drupal, @jhmnieuwenhuis?

The "Error: relation x does not exist" error happens because of the way that Drupal 8 Storage layer was architected (for non-sql databases, but don't ask me why other than that). Cache and some other tables are not guaranteed to exist at run time, and are created as-needed. This means that cache operations fail transactions. The pgsql driver catches these with its mocked "implicit commit" behavior that I had to write.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)

Agreed - It is good that people are paying attention to logs, but we need to know if this actually caused a problem.

@mradcliffe Is there a CR, a doc page, or something we could point people to, or create one?

mradcliffe’s picture

No, there is no change record or doc page. The relevant change is in #2181291: Prevent a query from aborting the entire transaction in pgsql back in 2014 (to mock implicit commits). Not sure about the storage layer docs.

I was looking for the equivalent of https://www.drupal.org/docs/7/system-requirements/database-server page on the Drupal 8 side, but couldn't find it. Good suggestion that it would be good to expand on this on a database server requirements doc page (or child page) for Drupal 8.

jhmnieuwenhuis’s picture

" Is there a specific error that is preventing you from installing Drupal, @jhmnieuwenhuis? "

No, this error does not prevent me from installing Drupal.

The installation runs and ends successfull.

It is just not nice to have so many errors in the log.

They may distract from "real" issues in the log.

Regards,

Hans Nieuwenhuis

Version: 8.2.4 » 8.2.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.2.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 9.3.x-dev
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

@ jhmnieuwenhuis, Thank you for reporting this problem. We rely on issue reports like this to improve Drupal core.

I tested this on 9.3.x and was able to install Drupal without errors in the logs. I used ddev with postgre, 13.4 (Debian 13.4-1.pgdg100+1).

Therefore, closing as cannot reproduce. If you are experiencing this problem reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

Thanks!

mradcliffe’s picture

The PostgreSQL log does still output errors when installing Drupal or using the install page due to Drupal requiring to check cache (tables) during the installation process. This is currently expected behavior even though it's not the ideal behavior. This might be "Closed (duplicate)" or "Closed (works as designed)" :| rather than "Closed (cannot reproduce)" so I'm re-opening so this can be re-triaged.

I don't know what the default settings are in Debian, but when logging is visible, these do appear in PostgreSQL's log.

For instance, if we merely go to /core/install.php, then

Apache:

[Mon Sep 20 18:14:49.579625 2021] [proxy:debug] [pid 24:tid 139732560825120] proxy_util.c(2589): [client 172.19.0.5:45084] AH00947: connected /var/www/html/core/install.php to php:9000, referer: https://drupal.docker.internal/core/install.php

PostgreSQL:

2021-09-20 18:14:49.710 UTC [71] ERROR:  relation "config" does not exist at character 20                                                                            
2021-09-20 18:14:49.710 UTC [71] STATEMENT:  SELECT "data" FROM "config" WHERE "collection" = '' AND "name" = 'core.extension'                                       
2021-09-20 18:14:49.711 UTC [71] ERROR:  relation "config" does not exist at character 20                                                                            
2021-09-20 18:14:49.711 UTC [71] STATEMENT:  SELECT "data" FROM "config" WHERE "collection" = '' AND "name" = 'system.site'

When the install is actually in-progress, for each module being installed, there are many "relation does not exist" errors logged to postgresql's log.

I updated the issue summary to be more clear.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.