Allow field names to start with reserved keywords (fix #3597) (#3927)

This commit is contained in:
Lyndon Maydwell 2020-04-02 16:27:43 +11:00 committed by GitHub
parent 69090427b9
commit 85b7c552af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 1 deletions

View File

@ -5,6 +5,7 @@
### Bug fixes and improvements
- docs: add One-Click Render deployment guide (close #3683) (#4209)
- server: reserved keywords in column references break parser (fix #3597) #3927
## `v1.2.0-beta.3`

View File

@ -34,7 +34,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/hasura/graphql-parser-hs.git
tag: 088acdf9120c4bea11f6185dfb587bd04ee2cb54
tag: 1380495a7b3269b70a7ab3081d745a5f54171a9c
source-repository-package
type: git

View File

@ -0,0 +1,19 @@
description: |
Using "null" prefixed columns in on_conflict clause should behave normally.
Regression test for #3597.
url: /v1/graphql
status: 200
query:
query: |
mutation {
insert_nullPrefixTestTable(objects: [{nullName: "2"}]
on_conflict:{constraint:nullPrefixTestTable_pkey, update_columns:[nullName]}){
affected_rows
}
}
response:
data:
insert_nullPrefixTestTable:
affected_rows: 1

View File

@ -0,0 +1,16 @@
type: bulk
args:
#Test table
- type: run_sql
args:
sql: |
create table "nullPrefixTestTable"(
id serial primary key,
"nullName" text
);
- type: track_table
args:
schema: public
name: "nullPrefixTestTable"

View File

@ -0,0 +1,7 @@
type: bulk
args:
- type: run_sql
args:
sql: |
drop table "nullPrefixTestTable"

View File

@ -187,6 +187,18 @@ class TestGraphqlInsertConstraints:
return "queries/graphql_mutation/insert/constraints"
@pytest.mark.parametrize("transport", ['http', 'websocket'])
@usefixtures('per_class_tests_db_state')
class TestGraphqlInsertNullPrefixedColumnOnConflict:
def test_address_not_null_constraint_err(self, hge_ctx, transport):
check_query_f(hge_ctx, self.dir() + "/null_prefixed_column_ok.yaml")
@classmethod
def dir(cls):
return "queries/graphql_mutation/insert/nullprefixcolumn"
@pytest.mark.parametrize("transport", ['http', 'websocket'])
@use_mutation_fixtures
class TestGraphqlInsertGeoJson: