fix: Make recursive view parsing work with XMLTABLE + DEFAULT

This commit is contained in:
Wolfgang Walther
2021-12-24 19:01:20 +01:00
committed by Wolfgang Walther
parent ac3655df1d
commit b99c8c897c
4 changed files with 36 additions and 9 deletions
+18
View File
@@ -2462,3 +2462,21 @@ BEGIN
INSERT INTO deferrable_unique_constraint VALUES (1), (1);
END$$;
-- This view is not used in any requests but just parsed by the pfkSourceColumns query.
-- XMLTABLE is only supported from PG 10 on
DO $do$
BEGIN
IF current_setting('server_version_num')::INT >= 100000 THEN
CREATE VIEW test.xml AS
SELECT *
FROM (SELECT ''::xml AS data) _,
XMLTABLE(
''
PASSING data
COLUMNS id int PATH '@id',
premier_name text PATH 'PREMIER_NAME' DEFAULT 'not specified'
);
END IF;
END
$do$;
+9 -3
View File
@@ -741,7 +741,9 @@ def test_admin_healthy_w_channel(defaultenv):
}
with run(env=env) as postgrest:
response = requests.get(f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/health")
response = requests.get(
f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/health"
)
assert response.status_code == 200
@@ -755,7 +757,9 @@ def test_admin_healthy_wo_channel(defaultenv):
}
with run(env=env) as postgrest:
response = requests.get(f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/health")
response = requests.get(
f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/health"
)
assert response.status_code == 200
@@ -768,5 +772,7 @@ def test_admin_not_found(defaultenv):
}
with run(env=env) as postgrest:
response = requests.get(f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/notfound")
response = requests.get(
f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/notfound"
)
assert response.status_code == 404