Fix #1008, Handle columns that contain spaces
This commit is contained in:
committed by
Steve Chávez
parent
d78410473e
commit
36f86827ee
@@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- #1180, Fix embedding on views with subselects in pg10 - @steve-chavez
|
||||
- #1197, Allow CORS for PUT - @bkylerussell
|
||||
- #1181, Correctly qualify function argument of custom type in public schema - @steve-chavez
|
||||
- #1008, Allow columns that contain spaces in filters - @steve-chavez
|
||||
|
||||
## [5.1.0] - 2018-08-31
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ pStar = toS <$> (string "*" $> ("*"::ByteString))
|
||||
pFieldName :: Parser Text
|
||||
pFieldName =
|
||||
intercalate "-" . map toS <$>
|
||||
(many1 (letter <|> digit <|> oneOf "_") `sepBy1` dash) <?>
|
||||
(many1 (letter <|> digit <|> oneOf "_ ") `sepBy1` dash) <?>
|
||||
"field name (* or [a..z0..9_])"
|
||||
where
|
||||
isDash :: GenParser Char st ()
|
||||
|
||||
@@ -819,6 +819,15 @@ spec = do
|
||||
[json| [{"escapeId":{"so6meIdColumn":1}},{"escapeId":{"so6meIdColumn":3}},{"escapeId":{"so6meIdColumn":5}}] |]
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
it "will select and filter a column that has spaces" $
|
||||
get "/Server%20Today?select=Just%20A%20Server%20Model&Just%20A%20Server%20Model=like.*91*" `shouldRespondWith`
|
||||
[json|[
|
||||
{"Just A Server Model":" IBM,9113-550 (P5-550)"},
|
||||
{"Just A Server Model":" IBM,9113-550 (P5-550)"},
|
||||
{"Just A Server Model":" IBM,9131-52A (P5-52A)"},
|
||||
{"Just A Server Model":" IBM,9133-55A (P5-55A)"}]|]
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
describe "binary output" $ do
|
||||
context "on GET" $ do
|
||||
it "can query if a single column is selected" $
|
||||
|
||||
Vendored
+9
@@ -473,3 +473,12 @@ INSERT INTO ltree_sample VALUES ('Top.Science.Astronomy.Cosmology');
|
||||
|
||||
TRUNCATE TABLE isn_sample CASCADE;
|
||||
INSERT INTO isn_sample VALUES ('978-0-393-04002-9', 'Mathematics: From the Birth of Numbers');
|
||||
|
||||
TRUNCATE TABLE "Server Today" CASCADE;
|
||||
COPY "Server Today" ("cHostname", "Just A Server Model") FROM STDIN CSV DELIMITER '|';
|
||||
argnim1 | IBM,9113-550 (P5-550)
|
||||
argnim2 | IBM,9113-550 (P5-550)
|
||||
daaa2nim71 | IBM,9131-52A (P5-52A)
|
||||
daah3nim71 | IBM,8406-71Y (P7-PS701)
|
||||
hbnim1 | IBM,9133-55A (P5-55A)
|
||||
\.
|
||||
|
||||
Vendored
+1
@@ -96,6 +96,7 @@ GRANT ALL ON TABLE
|
||||
, ltree_sample
|
||||
, isn_sample
|
||||
, projects_count_grouped_by
|
||||
, "Server Today"
|
||||
TO postgrest_test_anonymous;
|
||||
|
||||
GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous;
|
||||
|
||||
Vendored
+5
@@ -1636,3 +1636,8 @@ create table test.isn_sample (
|
||||
create function test.is_valid_isbn(input text) returns boolean as $$
|
||||
select is_valid(input::isbn);
|
||||
$$ language sql;
|
||||
|
||||
create table "Server Today"(
|
||||
"cHostname" text,
|
||||
"Just A Server Model" text
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user