From d83e70a71148e70d8fdff82ca86227f45a7292a4 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 11 Mar 2023 16:41:01 -0500 Subject: [PATCH] use id as the default --- src/pg/table_source.rs | 4 ++-- tests/config.yaml | 1 + tests/expected/configured/cmp_0_0_0.pbf | Bin 1181 -> 1177 bytes tests/expected/configured/cmp_0_0_0.pbf.txt | 2 +- tests/expected/generated_config.yaml | 9 --------- tests/expected/given_config.yaml | 1 + 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/pg/table_source.rs b/src/pg/table_source.rs index 40f72ffed..2014ff99d 100644 --- a/src/pg/table_source.rs +++ b/src/pg/table_source.rs @@ -28,7 +28,7 @@ pub async fn get_table_sources(pool: &PgPool) -> Result { let mut res = SqlTableInfoMapMapMap::new(); for row in &rows { let info = TableInfo { - layer_id: Some(row.get("name")), + layer_id: None, schema: row.get("schema"), table: row.get("name"), geometry_column: row.get("geom"), @@ -137,7 +137,7 @@ pub async fn table_to_query( }; let limit_clause = max_feature_count.map_or(String::new(), |v| format!("LIMIT {v}")); - let layer_id = escape_literal(info.layer_id.as_ref().unwrap_or(&info.table)); + let layer_id = escape_literal(info.layer_id.as_ref().unwrap_or(&id)); let clip_geom = info.clip_geom.unwrap_or(DEFAULT_CLIP_GEOM); let query = format!( r#" diff --git a/tests/config.yaml b/tests/config.yaml index 81501e89f..0019cf255 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -76,6 +76,7 @@ postgres: taBLe: text points1: + layer_id: abc schema: public table: points1 minzoom: 0 diff --git a/tests/expected/configured/cmp_0_0_0.pbf b/tests/expected/configured/cmp_0_0_0.pbf index c8eb382eb7b82e158a7785f7f823cc17dde51f53..b83e6603287cb6ba6aec3726d9fd4ddeaeab8edd 100644 GIT binary patch delta 17 YcmbQsIg^t^>KF?bb7E5RMxKc*04gs8x&QzG delta 21 ccmbQqIhT`1>J$qXdqI9?UP-axMvjRr07MH0Y5)KL diff --git a/tests/expected/configured/cmp_0_0_0.pbf.txt b/tests/expected/configured/cmp_0_0_0.pbf.txt index d8f7a8970..9fafb14fb 100644 --- a/tests/expected/configured/cmp_0_0_0.pbf.txt +++ b/tests/expected/configured/cmp_0_0_0.pbf.txt @@ -1,6 +1,6 @@ ============================================================= layer: 0 - name: points1 + name: abc version: 2 extent: 4096 feature: 0 diff --git a/tests/expected/generated_config.yaml b/tests/expected/generated_config.yaml index 8b31426cd..f64535272 100644 --- a/tests/expected/generated_config.yaml +++ b/tests/expected/generated_config.yaml @@ -5,7 +5,6 @@ postgres: auto_publish: true tables: MixPoints: - layer_id: MixPoints schema: MixedCase table: MixPoints srid: 4326 @@ -18,7 +17,6 @@ postgres: Gid: int4 TABLE: text points1: - layer_id: points1 schema: public table: points1 srid: 4326 @@ -30,7 +28,6 @@ postgres: properties: gid: int4 points1_vw: - layer_id: points1_vw schema: public table: points1_vw srid: 4326 @@ -42,7 +39,6 @@ postgres: properties: gid: int4 points2: - layer_id: points2 schema: public table: points2 srid: 4326 @@ -54,7 +50,6 @@ postgres: properties: gid: int4 points3857: - layer_id: points3857 schema: public table: points3857 srid: 3857 @@ -66,7 +61,6 @@ postgres: properties: gid: int4 points_empty_srid: - layer_id: points_empty_srid schema: public table: points_empty_srid srid: 900913 @@ -78,7 +72,6 @@ postgres: properties: gid: int4 table_source: - layer_id: table_source schema: public table: table_source srid: 4326 @@ -90,7 +83,6 @@ postgres: properties: gid: int4 table_source_multiple_geom: - layer_id: table_source_multiple_geom schema: public table: table_source_multiple_geom srid: 4326 @@ -103,7 +95,6 @@ postgres: geom2: geometry gid: int4 table_source_multiple_geom.1: - layer_id: table_source_multiple_geom schema: public table: table_source_multiple_geom srid: 4326 diff --git a/tests/expected/given_config.yaml b/tests/expected/given_config.yaml index ba1c2e998..30b3f053e 100644 --- a/tests/expected/given_config.yaml +++ b/tests/expected/given_config.yaml @@ -21,6 +21,7 @@ postgres: properties: taBLe: text points1: + layer_id: abc schema: public table: points1 srid: 4326