mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-13 19:33:55 +03:00
server: fix issue with queries on character column types (close #6217)
GitOrigin-RevId: 81eaa0db63656b1d37b9b71736d4309af902cc47
This commit is contained in:
parent
0dfe83f931
commit
b00009f4bb
@ -14,6 +14,7 @@ keys in the response body.
|
||||
|
||||
- server: fix issue of not exposing mutation functions to the admin role when function permissions are inferred (fix #6503)
|
||||
- server: add "resource_version" field to metadata for concurrency control - disable lookup during migrations
|
||||
- server: fix issue with queries on character column types (close #6217)
|
||||
- server: optimize resolving source. Resolving a source would create connection pools every time. Optimize that to re-create connection pools only when necessary. (#609)
|
||||
|
||||
## v1.4.0-alpha.1
|
||||
|
@ -298,7 +298,7 @@ instance ToSQL PGScalarType where
|
||||
PGNumeric -> "numeric"
|
||||
PGMoney -> "money"
|
||||
PGBoolean -> "boolean"
|
||||
PGChar -> "character"
|
||||
PGChar -> "bpchar"
|
||||
PGVarchar -> "varchar"
|
||||
PGText -> "text"
|
||||
PGCitext -> "citext"
|
||||
@ -357,6 +357,8 @@ pgScalarTranslations =
|
||||
, ("boolean" , PGBoolean)
|
||||
, ("bool" , PGBoolean)
|
||||
|
||||
, ("bpchar" , PGChar)
|
||||
, ("char" , PGChar)
|
||||
, ("character" , PGChar)
|
||||
|
||||
, ("varchar" , PGVarchar)
|
||||
@ -401,7 +403,7 @@ isNumType PGMoney = True
|
||||
isNumType _ = False
|
||||
|
||||
stringTypes :: [PGScalarType]
|
||||
stringTypes = [PGVarchar, PGText, PGCitext]
|
||||
stringTypes = [PGVarchar, PGText, PGCitext, PGChar]
|
||||
|
||||
isStringType :: PGScalarType -> Bool
|
||||
isStringType = (`elem` stringTypes)
|
||||
|
@ -0,0 +1,18 @@
|
||||
# Test case for bug reported at https://github.com/hasura/graphql-engine/issues/6217
|
||||
description: Select projects with a given ID of type `character`
|
||||
url: /v1/graphql
|
||||
status: 200
|
||||
response:
|
||||
data:
|
||||
project:
|
||||
- id: 'bcd'
|
||||
- id: 'BCD'
|
||||
query:
|
||||
query: |
|
||||
query {
|
||||
project (
|
||||
where: {id: { _ilike: "b%"}}
|
||||
) {
|
||||
id
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ args:
|
||||
args:
|
||||
sql: |
|
||||
create table author(
|
||||
id serial primary key,
|
||||
id serial primary key,
|
||||
name text unique
|
||||
);
|
||||
CREATE TABLE article (
|
||||
@ -66,7 +66,6 @@ args:
|
||||
schema: public
|
||||
name: article
|
||||
|
||||
|
||||
#Article table
|
||||
- type: track_table
|
||||
args:
|
||||
@ -91,18 +90,35 @@ args:
|
||||
table: article
|
||||
column: author_id
|
||||
|
||||
|
||||
#Insert values
|
||||
#Insert values: City table
|
||||
- type: insert
|
||||
args:
|
||||
table: city
|
||||
objects:
|
||||
- name: Durham
|
||||
country: USA
|
||||
country: USA
|
||||
- name: New York
|
||||
country: USA
|
||||
- name: Framlingham
|
||||
country: UK
|
||||
- name: New Orleans
|
||||
- name: New Orleans
|
||||
country: USA
|
||||
|
||||
# Project table
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE project (
|
||||
id CHAR(3) PRIMARY KEY
|
||||
);
|
||||
|
||||
INSERT INTO project VALUES
|
||||
('abc'),
|
||||
('ABC'),
|
||||
('bcd'),
|
||||
('BCD');
|
||||
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: project
|
||||
|
@ -22,3 +22,8 @@ args:
|
||||
args:
|
||||
sql: |
|
||||
drop table city
|
||||
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
drop table project
|
||||
|
@ -0,0 +1,16 @@
|
||||
# Test case for bug reported at https://github.com/hasura/graphql-engine/issues/6217
|
||||
description: Select projects with a given ID of type `character`
|
||||
url: /v1/query
|
||||
status: 200
|
||||
response:
|
||||
- id: 'bcd'
|
||||
- id: 'BCD'
|
||||
query:
|
||||
type: select
|
||||
args:
|
||||
table: project
|
||||
where:
|
||||
id:
|
||||
$ilike: 'b%'
|
||||
columns:
|
||||
- id
|
@ -7,7 +7,7 @@ args:
|
||||
args:
|
||||
sql: |
|
||||
create table author(
|
||||
id serial primary key,
|
||||
id serial primary key,
|
||||
name text unique
|
||||
);
|
||||
CREATE TABLE article (
|
||||
@ -91,18 +91,35 @@ args:
|
||||
table: article
|
||||
column: author_id
|
||||
|
||||
|
||||
#Insert values
|
||||
#Insert values: City table
|
||||
- type: insert
|
||||
args:
|
||||
table: city
|
||||
objects:
|
||||
- name: Durham
|
||||
country: USA
|
||||
country: USA
|
||||
- name: New York
|
||||
country: USA
|
||||
- name: Framlingham
|
||||
country: UK
|
||||
- name: New Orleans
|
||||
- name: New Orleans
|
||||
country: USA
|
||||
|
||||
# Project table
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
CREATE TABLE project (
|
||||
id CHAR(3) PRIMARY KEY
|
||||
);
|
||||
|
||||
INSERT INTO project VALUES
|
||||
('abc'),
|
||||
('ABC'),
|
||||
('bcd'),
|
||||
('BCD');
|
||||
|
||||
- type: track_table
|
||||
args:
|
||||
schema: public
|
||||
name: project
|
||||
|
@ -22,3 +22,8 @@ args:
|
||||
args:
|
||||
sql: |
|
||||
drop table city
|
||||
|
||||
- type: run_sql
|
||||
args:
|
||||
sql: |
|
||||
drop table project
|
||||
|
@ -389,6 +389,9 @@ class TestGraphQLQueryBoolExpSearch:
|
||||
def test_city_where_niregex(self, hge_ctx, transport):
|
||||
check_query_f(hge_ctx, self.dir() + '/select_city_where_niregex.yaml', transport)
|
||||
|
||||
def test_project_where_ilike(self, hge_ctx, transport):
|
||||
check_query_f(hge_ctx, self.dir() + '/select_project_where_ilike.yaml', transport)
|
||||
|
||||
@classmethod
|
||||
def dir(cls):
|
||||
return 'queries/graphql_query/boolexp/search'
|
||||
|
@ -180,6 +180,9 @@ class TestV1SelectBoolExpSearch:
|
||||
def test_city_where_not_iregex(self, hge_ctx):
|
||||
check_query_f(hge_ctx, self.dir() + '/select_city_where_niregex.yaml')
|
||||
|
||||
def test_project_where_ilike(self, hge_ctx):
|
||||
check_query_f(hge_ctx, self.dir() + '/select_project_where_ilike.yaml')
|
||||
|
||||
@classmethod
|
||||
def dir(cls):
|
||||
return 'queries/v1/select/boolexp/search'
|
||||
|
Loading…
Reference in New Issue
Block a user