Skip to content

Commit

Permalink
Handle cased column names
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jul 5, 2024
1 parent 82aa625 commit 5a6a10c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/service/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ func normalizePropNames(requestNames []string, colNames []string) []string {
func toNameSet(strs []string) map[string]bool {
set := make(map[string]bool)
for _, s := range strs {
sLow := strings.ToLower(s)
set[sLow] = true
// keep case of property column names
set[s] = true
}
return set
}
Expand Down
7 changes: 7 additions & 0 deletions testing/pgfs_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ http://localhost:9000/collections/pgfs_test.test_crs/items.html?filter=intersect
```
http://localhost:9000/functions/postgisftw.countries_name/items.json?name_prefix=C&filter=continent%20ILIKE%20%27%25america%27
```

## Catalog handling

### Handle all column names
```
http://localhost:9000/collections/pgfs_test.test_names/items.json?properties=id,colCamelCase
```
22 changes: 22 additions & 0 deletions testing/pgfs_test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ VALUES
(2, 'SRID=4326;LINESTRING(1 1, 2 2)', 'bbb');

--=====================================================================

-- test array handling

CREATE TABLE pgfs_test.test_arr
(
id integer primary key,
Expand All @@ -104,6 +107,25 @@ INSERT INTO pgfs_test.test_arr
'{ 1.1, 2.2, 3.3 }',
'{ "a", "bb", "ccc" }' );

--=====================================================================

-- test column name handling

CREATE TABLE pgfs_test.test_names
(
id integer primary key,
geom geometry(point, 4326),
"colCamelCase" integer
);

-- DROP TABLE pgfs_test.test_names;

INSERT INTO pgfs_test.test_names
VALUES
(1, 'SRID=4326;POINT(1 1)', 1 ),
(2, 'SRID=4326;POINT(2 2)', 2 );


--=====================================================================
-- Test functions

Expand Down

0 comments on commit 5a6a10c

Please sign in to comment.