Skip to content

Commit 5a6a10c

Browse files
committed
Handle cased column names
1 parent 82aa625 commit 5a6a10c

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

internal/service/param.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ func normalizePropNames(requestNames []string, colNames []string) []string {
332332
func toNameSet(strs []string) map[string]bool {
333333
set := make(map[string]bool)
334334
for _, s := range strs {
335-
sLow := strings.ToLower(s)
336-
set[sLow] = true
335+
// keep case of property column names
336+
set[s] = true
337337
}
338338
return set
339339
}

testing/pgfs_test.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,10 @@ http://localhost:9000/collections/pgfs_test.test_crs/items.html?filter=intersect
8989
```
9090
http://localhost:9000/functions/postgisftw.countries_name/items.json?name_prefix=C&filter=continent%20ILIKE%20%27%25america%27
9191
```
92+
93+
## Catalog handling
94+
95+
### Handle all column names
96+
```
97+
http://localhost:9000/collections/pgfs_test.test_names/items.json?properties=id,colCamelCase
98+
```

testing/pgfs_test.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ VALUES
8585
(2, 'SRID=4326;LINESTRING(1 1, 2 2)', 'bbb');
8686

8787
--=====================================================================
88+
89+
-- test array handling
90+
8891
CREATE TABLE pgfs_test.test_arr
8992
(
9093
id integer primary key,
@@ -104,6 +107,25 @@ INSERT INTO pgfs_test.test_arr
104107
'{ 1.1, 2.2, 3.3 }',
105108
'{ "a", "bb", "ccc" }' );
106109

110+
--=====================================================================
111+
112+
-- test column name handling
113+
114+
CREATE TABLE pgfs_test.test_names
115+
(
116+
id integer primary key,
117+
geom geometry(point, 4326),
118+
"colCamelCase" integer
119+
);
120+
121+
-- DROP TABLE pgfs_test.test_names;
122+
123+
INSERT INTO pgfs_test.test_names
124+
VALUES
125+
(1, 'SRID=4326;POINT(1 1)', 1 ),
126+
(2, 'SRID=4326;POINT(2 2)', 2 );
127+
128+
107129
--=====================================================================
108130
-- Test functions
109131

0 commit comments

Comments
 (0)