mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 04:41:46 +03:00
Added a test for schema.table.column containing special chars (#1222)
This just adds a test for the unusual case of a table with quotes, spaces, and dots in their identifiers. Another similar test should be added for functions.
This commit is contained in:
parent
7c14a1528c
commit
c0ec365d5c
@ -57,6 +57,9 @@ postgres:
|
||||
fonts: {}
|
||||
sprites: {}
|
||||
tiles:
|
||||
".-Points---quote":
|
||||
content_type: application/x-protobuf
|
||||
description: Escaping test table
|
||||
MixPoints:
|
||||
content_type: application/x-protobuf
|
||||
description: a description from comment on table
|
||||
|
@ -18,6 +18,9 @@ async fn table_source() {
|
||||
let mock = mock_sources(mock_pgcfg("connection_string: $DATABASE_URL")).await;
|
||||
assert_yaml_snapshot!(mock.0.tiles.get_catalog(), @r###"
|
||||
---
|
||||
".-Points---quote":
|
||||
content_type: application/x-protobuf
|
||||
description: Escaping test table
|
||||
MixPoints:
|
||||
content_type: application/x-protobuf
|
||||
description: a description from comment on table
|
||||
|
@ -1,5 +1,9 @@
|
||||
{
|
||||
"tiles": {
|
||||
".-Points---quote": {
|
||||
"content_type": "application/x-protobuf",
|
||||
"description": "Escaping test table"
|
||||
},
|
||||
"MixPoints": {
|
||||
"content_type": "application/x-protobuf",
|
||||
"description": "a description from comment on table"
|
||||
|
@ -4,6 +4,20 @@ postgres:
|
||||
auto_bounds: calc
|
||||
auto_publish: true
|
||||
tables:
|
||||
.-Points---quote:
|
||||
schema: '"Quotes'' and Space.Dot.'
|
||||
table: . Points" 'quote
|
||||
srid: 4326
|
||||
geometry_column: . "Geom"
|
||||
bounds:
|
||||
- -170.94984639004662
|
||||
- -84.20025580733805
|
||||
- 167.70892858284475
|
||||
- 74.23573284753762
|
||||
geometry_type: POINT
|
||||
properties:
|
||||
''' id ''': int4
|
||||
'.namE ': text
|
||||
MixPoints:
|
||||
schema: MixedCase
|
||||
table: MixPoints
|
||||
|
@ -3,6 +3,20 @@ postgres:
|
||||
auto_bounds: calc
|
||||
auto_publish: true
|
||||
tables:
|
||||
.-Points---quote:
|
||||
schema: '"Quotes'' and Space.Dot.'
|
||||
table: . Points" 'quote
|
||||
srid: 4326
|
||||
geometry_column: . "Geom"
|
||||
bounds:
|
||||
- -170.94984639004662
|
||||
- -84.20025580733805
|
||||
- 167.70892858284475
|
||||
- 74.23573284753762
|
||||
geometry_type: POINT
|
||||
properties:
|
||||
''' id ''': int4
|
||||
'.namE ': text
|
||||
MixPoints:
|
||||
schema: MixedCase
|
||||
table: MixPoints
|
||||
|
@ -3,6 +3,20 @@ postgres:
|
||||
auto_bounds: calc
|
||||
auto_publish: true
|
||||
tables:
|
||||
.-Points---quote:
|
||||
schema: '"Quotes'' and Space.Dot.'
|
||||
table: . Points" 'quote
|
||||
srid: 4326
|
||||
geometry_column: . "Geom"
|
||||
bounds:
|
||||
- -170.94984639004662
|
||||
- -84.20025580733805
|
||||
- 167.70892858284475
|
||||
- 74.23573284753762
|
||||
geometry_type: POINT
|
||||
properties:
|
||||
''' id ''': int4
|
||||
'.namE ': text
|
||||
MixPoints:
|
||||
schema: MixedCase
|
||||
table: MixPoints
|
||||
|
@ -3,6 +3,20 @@ postgres:
|
||||
auto_bounds: calc
|
||||
auto_publish: true
|
||||
tables:
|
||||
.-Points---quote:
|
||||
schema: '"Quotes'' and Space.Dot.'
|
||||
table: . Points" 'quote
|
||||
srid: 4326
|
||||
geometry_column: . "Geom"
|
||||
bounds:
|
||||
- -170.94984639004662
|
||||
- -84.20025580733805
|
||||
- 167.70892858284475
|
||||
- 74.23573284753762
|
||||
geometry_type: POINT
|
||||
properties:
|
||||
''' id ''': int4
|
||||
'.namE ': text
|
||||
MixPoints:
|
||||
schema: MixedCase
|
||||
table: MixPoints
|
||||
|
64
tests/fixtures/tables/SpacesAndQuotes.sql
vendored
Normal file
64
tests/fixtures/tables/SpacesAndQuotes.sql
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
DROP SCHEMA IF EXISTS """Quotes' and Space.Dot." CASCADE;
|
||||
CREATE SCHEMA """Quotes' and Space.Dot.";
|
||||
|
||||
CREATE TABLE """Quotes' and Space.Dot.".". Points"" 'quote"
|
||||
(
|
||||
"' id '" SERIAL PRIMARY KEY,
|
||||
".namE " TEXT,
|
||||
". ""Geom""" GEOMETRY(POINT, 4326)
|
||||
);
|
||||
|
||||
-- INSERT INTO """Quotes' and Space.Dot.".". Points"" 'quote"
|
||||
-- SELECT generate_series(1, 3),
|
||||
-- md5(random()::text),
|
||||
-- (ST_DUMP(ST_GENERATEPOINTS(st_transform(st_tileenvelope(18, 235085, 122323), 4326), 3))).Geom;
|
||||
-- INSERT INTO """Quotes' and Space.Dot.".". Points"" 'quote"
|
||||
-- SELECT generate_series(4, 30),
|
||||
-- md5(random()::text),
|
||||
-- (ST_DUMP(ST_GENERATEPOINTS(st_transform(st_tileenvelope(0, 0, 0), 4326), 27))).Geom;
|
||||
--
|
||||
-- To dump the data above, uncomment code the above, comment the INSERT code bellow, and run:
|
||||
-- just restart
|
||||
-- just pg_dump --data-only --inserts --rows-per-insert=100 --table="""Quotes' and Space.Dot.".". Points"" 'quote"
|
||||
|
||||
INSERT INTO """Quotes' and Space.Dot.".". Points"" 'quote"
|
||||
values (1, '02daedc70702ec68753fde38351f5d9d', '0101000020E610000050C4D38CE9DA61401EFC0EC7C3DA2740'),
|
||||
(2, '7418427ba8a960c3661235f47cc13d46', '0101000020E6100000CC2F4170E9DA6140DEDB02B581DA2740'),
|
||||
(3, 'd5a11dee7203a09442168eec74c7bea8', '0101000020E6100000008E66E9E6DA614059944356B4DA2740'),
|
||||
(4, '2368bbc7ba9dcb274f5465ef10ffad1f', '0101000020E6100000B43E295A4CEE6140265634327FFB52C0'),
|
||||
(5, '140cf506fdf19e0cd451bc0da0ad8b50', '0101000020E610000016551B51B0B033407C3AE7BBE91B3140'),
|
||||
(6, 'e8d7e0e5b421079203c2f1a84f62d029', '0101000020E61000007CD7F65C2360604055855E6358954F40'),
|
||||
(7, 'eeea13624e9c7ba34ad7210498061fd9', '0101000020E6100000B5E96FF565874D40328E73C500A951C0'),
|
||||
(8, '32b066ccc705875a6ba04a4f8fe6ef26', '0101000020E61000002AAF4124655E65C06C3CC08BDE884040'),
|
||||
(9, '7c304793df1ff378d775106b31a14bea', '0101000020E6100000D0CAD2D7A9790DC000065E0B160843C0'),
|
||||
(10, 'b936821caa8237e331f26ddf5165784b', '0101000020E6100000CA5016BD8E9563403E9A0372E7932E40'),
|
||||
(11, '434749fa23d9302d475f7ec190981958', '0101000020E61000004AA2B720B23E45C0E94EBCDB72014740'),
|
||||
(12, 'fb78b6759036417511bc13e47bc25db8', '0101000020E6100000A35AEF6470684B4006C609806BC74440'),
|
||||
(13, '730b7f416d91573e5a5d4c32673c716e', '0101000020E61000003BF842670F9B484030FA0AA450DE4D40'),
|
||||
(14, 'e51f27140b07abdf60b6b0e86271446d', '0101000020E6100000FC54A712989843C0664EB161D4D943C0'),
|
||||
(15, '1128b472f9ce87958e2b941f732bde55', '0101000020E6100000DBDDCAA1D80B63C0E84F2B8BC8C63DC0'),
|
||||
(16, 'ff2d28a9b608cb6ef29751c1b7cefc8b', '0101000020E610000082EA2075B2D26440A2B180EAFCEF52C0'),
|
||||
(17, '6e0d72a4b999f6f993a86af936fde899', '0101000020E610000028E151D6194825C0FD73E0FC5B8615C0'),
|
||||
(18, '23afce20fa2dd8d8d1f93014447fdba6', '0101000020E6100000B3376FB629D660C017B1393F168F5240'),
|
||||
(19, '38cb097c70d2ff71e8c8c02855f04166', '0101000020E6100000F1FCE46A01865540EAE8C01038D852C0'),
|
||||
(20, 'b82d2222d84deecd38a6187a86fd3514', '0101000020E61000005C4A75FF750661C08012B03D84A5EE3F'),
|
||||
(21, '9efc50c9da5f0da5040c565b2ba838ce', '0101000020E61000008037CA00BD693E4018F8D89279004FC0'),
|
||||
(22, 'a2dbb89488297ad2c6af9460980479a3', '0101000020E610000092D0FE8AAFF664401EE866F4AF5D3B40'),
|
||||
(23, '09e3dc819cfd6344bce527be0ef29086', '0101000020E6100000A6235C70F6C053C0C0E86095B8AA0940'),
|
||||
(24, 'fd59276e15c0577881118df65e3b2b9a', '0101000020E610000078B4CD86D3444240FF879F9C924B4840'),
|
||||
(25, 'a8a47755660da683c7817634797515e8', '0101000020E6100000B2E72AE85C0143C04487454A6F1F4FC0'),
|
||||
(26, 'b44bf3139cc2bab31a48b165f63dfaa3', '0101000020E61000008224AB2C6A3364C00C1DD30085CF32C0'),
|
||||
(27, '48b2e0ae68663d5dc003f20e2cc9dba1', '0101000020E6100000981F49E883D45B405CE9B4808E2637C0'),
|
||||
(28, '5e27d8b2cbee33e3196aae5e5ec15db2', '0101000020E61000001036BD0CF11F1440600218267D833740'),
|
||||
(29, 'fd0775c59700ac8c1982aa3efe6cb0c7', '0101000020E6100000D6CF48A3E1A9464077D6BBFDD00C55C0'),
|
||||
(30, '404175d17b08782edc9d316c378adc86', '0101000020E6100000F9B5A5ADB7265BC0EE07F81F2F284840');
|
||||
|
||||
CREATE INDEX ON """Quotes' and Space.Dot.".". Points"" 'quote" USING GIST (". ""Geom""");
|
||||
|
||||
DO $do$ BEGIN
|
||||
EXECUTE 'COMMENT ON TABLE """Quotes'' and Space.Dot.".". Points"" ''quote" IS $tj$' || $$
|
||||
{
|
||||
"description": "Escaping test table"
|
||||
}
|
||||
$$::json || '$tj$';
|
||||
END $do$;
|
Loading…
Reference in New Issue
Block a user