[ticket/17148] Fix sql_table_exists() error for PostgreSQL 9.3 and earlier

PostgreSQL 9.3 and earlier versions don't support Empty SELECT lists
(support was added since v. 9.4).
Also add PostgreSQL 9.3 tests as earlier images fail in current tests env.

PHPBB3-17148
This commit is contained in:
rxu 2023-06-17 12:36:29 +07:00
parent 75dcbeaa9f
commit 8c33a2180d
No known key found for this signature in database
GPG key ID: 955F0567380E586A
2 changed files with 4 additions and 2 deletions

View file

@ -233,6 +233,8 @@ jobs:
strategy:
matrix:
include:
- php: '7.1'
db: "postgres:9.3"
- php: '7.1'
db: "postgres:9.5"
- php: '7.1'
@ -264,7 +266,7 @@ jobs:
services:
postgres:
image: ${{ matrix.db != 'postgres:9.5' && matrix.db != 'postgres:9.6' && matrix.db != 'postgres:10' && matrix.db != 'postgres:11' && matrix.db != 'postgres:12' && matrix.db != 'postgres:13' && 'postgres:10' || matrix.db }}
image: ${{ matrix.db != 'postgres:9.3' && matrix.db != 'postgres:9.5' && matrix.db != 'postgres:9.6' && matrix.db != 'postgres:10' && matrix.db != 'postgres:11' && matrix.db != 'postgres:12' && matrix.db != 'postgres:13' && 'postgres:10' || matrix.db }}
env:
POSTGRES_HOST: localhost
POSTGRES_USER: postgres

View file

@ -102,7 +102,7 @@ class postgres extends tools
function sql_table_exists($table_name)
{
$sql = "SELECT CAST(EXISTS(
SELECT FROM information_schema.tables
SELECT * FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = '" . $this->db->sql_escape($table_name) . "'
) AS INTEGER)";