From 105671e51a1e4d7995c530e05771ec78cd6c7145 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Sat, 14 Jul 2018 13:22:08 -0500 Subject: [PATCH] Fix #1129, view embedding on capitalized table - Now also works on camelCase fk column --- CHANGELOG.md | 1 + test/Feature/QuerySpec.hs | 3 +++ test/fixtures/privileges.sql | 2 ++ test/fixtures/schema.sql | 14 ++++++++++++++ 4 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05b280aa7..e41a5ad31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #1113, Fix UPSERT failing when having a camel case PK column - @steve-chavez - #945, Fix slow start-up time on big schemas - @steve-chavez +- #1129, Fix view embedding when table is capitalized - @steve-chavez ### Changed diff --git a/test/Feature/QuerySpec.hs b/test/Feature/QuerySpec.hs index a59ad34a1..a0769213a 100644 --- a/test/Feature/QuerySpec.hs +++ b/test/Feature/QuerySpec.hs @@ -377,6 +377,9 @@ spec = do "books":[{"title":"The Little Prince"}]} ]|] { matchHeaders = [matchContentTypeJson] } + it "works when having a capitalized table name and camelCase fk column" $ + get "/foos?select=*,bars(*)" `shouldRespondWith` 200 + describe "path fixed" $ do it "works when requesting children 2 levels" $ get "/clients?id=eq.1&select=id,projects:projects.client_id(id,tasks(id))" `shouldRespondWith` diff --git a/test/fixtures/privileges.sql b/test/fixtures/privileges.sql index 0bd874732..38440dbce 100644 --- a/test/fixtures/privileges.sql +++ b/test/fixtures/privileges.sql @@ -84,6 +84,8 @@ GRANT ALL ON TABLE , jsonb_test , authors_books_number , authors_have_book_in_decade + , foos + , bars TO postgrest_test_anonymous; GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous; diff --git a/test/fixtures/schema.sql b/test/fixtures/schema.sql index 689faed54..e4af1a68d 100755 --- a/test/fixtures/schema.sql +++ b/test/fixtures/schema.sql @@ -1522,3 +1522,17 @@ select ELSE false END AS has_book_in_sixties from private.authors x; + +CREATE TABLE test."Foo"( + id int primary key, + name text +); + +CREATE TABLE test.bar( + id int primary key, + name text, + "fooId" int references "Foo"(id) +); + +CREATE VIEW test.foos as select id,name from "Foo"; +CREATE VIEW test.bars as select id, "fooId", name from bar;