Skip to content

Commit

Permalink
use id as the default
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Mar 11, 2023
1 parent 86101c2 commit d83e70a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/pg/table_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub async fn get_table_sources(pool: &PgPool) -> Result<SqlTableInfoMapMapMap> {
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"),
Expand Down Expand Up @@ -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#"
Expand Down
1 change: 1 addition & 0 deletions tests/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ postgres:
taBLe: text

points1:
layer_id: abc
schema: public
table: points1
minzoom: 0
Expand Down
Binary file modified tests/expected/configured/cmp_0_0_0.pbf
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/expected/configured/cmp_0_0_0.pbf.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=============================================================
layer: 0
name: points1
name: abc
version: 2
extent: 4096
feature: 0
Expand Down
9 changes: 0 additions & 9 deletions tests/expected/generated_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ postgres:
auto_publish: true
tables:
MixPoints:
layer_id: MixPoints
schema: MixedCase
table: MixPoints
srid: 4326
Expand All @@ -18,7 +17,6 @@ postgres:
Gid: int4
TABLE: text
points1:
layer_id: points1
schema: public
table: points1
srid: 4326
Expand All @@ -30,7 +28,6 @@ postgres:
properties:
gid: int4
points1_vw:
layer_id: points1_vw
schema: public
table: points1_vw
srid: 4326
Expand All @@ -42,7 +39,6 @@ postgres:
properties:
gid: int4
points2:
layer_id: points2
schema: public
table: points2
srid: 4326
Expand All @@ -54,7 +50,6 @@ postgres:
properties:
gid: int4
points3857:
layer_id: points3857
schema: public
table: points3857
srid: 3857
Expand All @@ -66,7 +61,6 @@ postgres:
properties:
gid: int4
points_empty_srid:
layer_id: points_empty_srid
schema: public
table: points_empty_srid
srid: 900913
Expand All @@ -78,7 +72,6 @@ postgres:
properties:
gid: int4
table_source:
layer_id: table_source
schema: public
table: table_source
srid: 4326
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/expected/given_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ postgres:
properties:
taBLe: text
points1:
layer_id: abc
schema: public
table: points1
srid: 4326
Expand Down

0 comments on commit d83e70a

Please sign in to comment.