Revert "Add _cast support for other postgres datatypes fix #6050 and …

…fix #5426"

This reverts commit f85742318167d1e51f463c45fcd00f26269c2555.

## Description ✍️
With this commit there is the possiblity that you could get conflicting
type definitions with remote schemas. Reverting for now as we determine
a solution. At which point we will add this back in.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4879
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 932b4a9226717c826d4bde7e375695354cee8c0c
This commit is contained in:
Brandon Martin 2022-06-29 06:08:33 -06:00 committed by hasura-bot
parent 2fc1bafb40
commit 5e29a1304d
8 changed files with 4 additions and 346 deletions

View File

@ -203,6 +203,7 @@ get_server_upgrade_tests() {
--deselect test_graphql_queries.py::TestGraphQLExplainCommon::test_limit_orderby_relationship_query \
--deselect test_graphql_queries.py::TestGraphQLExplainCommon::test_limit_offset_orderby_relationship_query \
--deselect test_graphql_queries.py::TestGraphQLExplainPostgresMSSQLMySQL::test_limit_orderby_column_query \
--deselect test_graphql_queries.py::TestGraphQLQueryBoolExpBasicPostgres::test_select_cast_test_where_cast_string \
1>/dev/null 2>/dev/null
set +x
# Choose the subset of jobs to run based on possible parallelism in this buildkite job
@ -243,6 +244,7 @@ run_server_upgrade_pytest() {
--deselect test_graphql_queries.py::TestGraphQLExplainCommon::test_limit_orderby_relationship_query \
--deselect test_graphql_queries.py::TestGraphQLExplainCommon::test_limit_offset_orderby_relationship_query \
--deselect test_graphql_queries.py::TestGraphQLExplainPostgresMSSQLMySQL::test_limit_orderby_column_query \
--deselect test_graphql_queries.py::TestGraphQLQueryBoolExpBasicPostgres::test_select_cast_test_where_cast_string \
-v $tests_to_run
set +x
cd -

View File

@ -2,6 +2,8 @@
## Next release
server: revert allow casting most postgres scalar types to strings in comparison expressions (#8617)
### Behaviour changes
- cli: use 2-spaces indent for graphql content in metadata instead of tabs(#8469)

View File

@ -216,21 +216,6 @@ parseBoolExpOperations rhsParser rootTable fim columnRef value = do
(ColumnScalar PGGeometry, PGGeography) -> return ()
(ColumnScalar PGGeography, PGGeometry) -> return ()
(ColumnScalar PGJSONB, PGText) -> return ()
(ColumnScalar PGSmallInt, PGText) -> return ()
(ColumnScalar PGInteger, PGText) -> return ()
(ColumnScalar PGBigInt, PGText) -> return ()
(ColumnScalar PGFloat, PGText) -> return ()
(ColumnScalar PGDouble, PGText) -> return ()
(ColumnScalar PGNumeric, PGText) -> return ()
(ColumnScalar PGMoney, PGText) -> return ()
(ColumnScalar PGBoolean, PGText) -> return ()
(ColumnScalar PGChar, PGText) -> return ()
(ColumnScalar PGDate, PGText) -> return ()
(ColumnScalar PGTimeStamp, PGText) -> return ()
(ColumnScalar PGTimeStampTZ, PGText) -> return ()
(ColumnScalar PGTimeTZ, PGText) -> return ()
(ColumnScalar PGJSON, PGText) -> return ()
(ColumnScalar PGUUID, PGText) -> return ()
_ ->
throw400 UnexpectedPayload $
"cannot cast column of type " <> colTy <<> " to type " <>> targetType

View File

@ -658,21 +658,6 @@ comparisonExps = memoize 'comparisonExps \columnType -> do
ColumnScalar PGGeography -> Just (PGGeography, PGGeometry)
ColumnScalar PGGeometry -> Just (PGGeometry, PGGeography)
ColumnScalar PGJSONB -> Just (PGJSONB, PGText)
ColumnScalar PGSmallInt -> Just (PGSmallInt, PGText)
ColumnScalar PGInteger -> Just (PGInteger, PGText)
ColumnScalar PGBigInt -> Just (PGBigInt, PGText)
ColumnScalar PGFloat -> Just (PGFloat, PGText)
ColumnScalar PGDouble -> Just (PGDouble, PGText)
ColumnScalar PGNumeric -> Just (PGNumeric, PGText)
ColumnScalar PGMoney -> Just (PGMoney, PGText)
ColumnScalar PGBoolean -> Just (PGBoolean, PGText)
ColumnScalar PGChar -> Just (PGChar, PGText)
ColumnScalar PGDate -> Just (PGDate, PGText)
ColumnScalar PGTimeStamp -> Just (PGTimeStamp, PGText)
ColumnScalar PGTimeStampTZ -> Just (PGTimeStampTZ, PGText)
ColumnScalar PGTimeTZ -> Just (PGTimeTZ, PGText)
ColumnScalar PGJSON -> Just (PGJSON, PGText)
ColumnScalar PGUUID -> Just (PGUUID, PGText)
_ -> Nothing
forM maybeScalars $ \(sourceScalar, targetScalar) -> do

View File

@ -1,250 +0,0 @@
- description: Fetch data from cast_test table for smallint column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 1
smallint_col: 123
query:
query: |-
query {
cast_test (where: {smallint_col: {_cast: {String: {_ilike: "123"}}}}){
id
smallint_col
}
}
- description: Fetch data from cast_test table for integer column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 2
integer_col: 123
query:
query: |-
query {
cast_test (where: {integer_col: {_cast: {String: {_ilike: "123"}}}}){
id
integer_col
}
}
- description: Fetch data from cast_test table for bigint column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 3
bigint_col: '123'
query:
query: |-
query {
cast_test (where: {bigint_col: {_cast: {String: {_ilike: "123"}}}}){
id
bigint_col
}
}
- description: Fetch data from cast_test table for float column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 4
float_col: '1.23'
query:
query: |-
query {
cast_test (where: {float_col: {_cast: {String: {_ilike: "1.23"}}}}){
id
float_col
}
}
- description: Fetch data from cast_test table for double column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 5
double_col: '1.23'
query:
query: |-
query {
cast_test (where: {double_col: {_cast: {String: {_ilike: "1.23"}}}}){
id
double_col
}
}
- description: Fetch data from cast_test table for numeric column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 6
numeric_col: '123'
query:
query: |-
query {
cast_test (where: {numeric_col: {_cast: {String: {_ilike: "123"}}}}){
id
numeric_col
}
}
- description: Fetch data from cast_test table for money column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 7
money_col: '$1.23'
query:
query: |-
query {
cast_test (where: {money_col: {_cast: {String: {_ilike: "%1%"}}}}){
id
money_col
}
}
- description: Fetch data from cast_test table for boolean column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 8
boolean_col: true
query:
query: |-
query {
cast_test (where: {boolean_col: {_cast: {String: {_ilike: "true"}}}}){
id
boolean_col
}
}
- description: Fetch data from cast_test table for char column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 9
char_col: 'a'
query:
query: |-
query {
cast_test (where: {char_col: {_cast: {String: {_ilike: "a"}}}}){
id
char_col
}
}
- description: Fetch data from cast_test table for date column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 10
date_col: '2018-05-12'
query:
query: |-
query {
cast_test (where: {date_col: {_cast: {String: {_ilike: "2018-%"}}}}){
id
date_col
}
}
- description: Fetch data from cast_test table for timestamp column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 11
timestamp_col: '2018-09-21T09:50:44'
query:
query: |-
query {
cast_test (where: {timestamp_col: {_cast: {String: {_ilike: "2018-%"}}}}){
id
timestamp_col
}
}
- description: Fetch data from cast_test table for timestamptz column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 12
timestamptz_col: '2018-09-21T09:50:44+00:00'
query:
query: |-
query {
cast_test (where: {timestamptz_col: {_cast: {String: {_ilike: "2018-%"}}}}){
id
timestamptz_col
}
}
- description: Fetch data from cast_test table for timetz column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 13
timetz_col: '09:50:44+00'
query:
query: |-
query {
cast_test (where: {timetz_col: {_cast: {String: {_ilike: "09%"}}}}){
id
timetz_col
}
}
- description: Fetch data from cast_test table for json column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 14
json_col:
- foo
query:
query: |-
query {
cast_test (where: {json_col: {_cast: {String: {_ilike: "%f%"}}}}){
id
json_col
}
}
- description: Fetch data from cast_test table for uuid column after casting to string
url: /v1/graphql
status: 200
response:
data:
cast_test:
- id: 15
uuid_col: '28d6d683-1317-49f7-b1cf-7d195242e4e5'
query:
query: |-
query {
cast_test (where: {uuid_col: {_cast: {String: {_ilike: "%7d195242e4e5"}}}}){
id
uuid_col
}
}

View File

@ -143,25 +143,6 @@ args:
, sql_id information_schema.sql_identifier );
INSERT INTO table_with_sql_identifier (sql_id)
VALUES ('one'), ('one'), ('two'), ('three'), ('four'), ('one'), ('two');
CREATE TABLE "cast_test" (
id serial primary key,
smallint_col smallint,
integer_col integer,
bigint_col bigint,
float_col float,
double_col double precision,
numeric_col numeric,
money_col money,
boolean_col boolean,
char_col char,
date_col date,
timestamp_col timestamp,
timestamptz_col timestamptz,
timetz_col timetz,
json_col json,
uuid_col uuid
);
- type: track_table
args:
@ -303,46 +284,3 @@ args:
- type: track_table
args: table_with_sql_identifier
#Table to test _cast to string
- type: track_table
args:
name: cast_test
schema: public
- type: insert
args:
table: cast_test
objects:
- smallint_col: 123
- integer_col: 123
- bigint_col: 123
- float_col: 1.23
- double_col: 1.23
- numeric_col: 123
- money_col: 1.23
- boolean_col: true
- char_col: 'a'
- date_col: '2018-05-12'
- timestamp_col: '2018-09-21T09:50:44'
- timestamptz_col: '2018-09-21T09:50:44'
- timetz_col: '09:50:44'
- json_col:
- foo
- uuid_col: 28d6d683-1317-49f7-b1cf-7d195242e4e5
- smallint_col: 789
- integer_col: 789
- bigint_col: 789
- float_col: 7.89
- double_col: 7.89
- numeric_col: 789
- money_col: 7.89
- boolean_col: false
- char_col: 'z'
- date_col: '2019-01-11'
- timestamp_col: '2019-01-21T01:10:11'
- timestamptz_col: '2019-01-21T01:10:11'
- timetz_col: '01:51:11'
- json_col:
- bar
- uuid_col: 28d6d683-1317-49f7-b1cf-7d195242e4e6

View File

@ -12,5 +12,4 @@ args:
DROP TABLE uuid_test;
DROP TABLE "user";
DROP TABLE account;
DROP TABLE cast_test;
cascade: true

View File

@ -652,9 +652,6 @@ class TestGraphQLQueryBoolExpBasicPostgres:
def test_in_sql_identifier_array(self, hge_ctx, transport):
check_query_f(hge_ctx, self.dir() + '/in_sql_identifier_array.yaml', transport)
def test_select_cast_test_where_cast_string(self, hge_ctx, transport):
check_query_f(hge_ctx, self.dir() + '/select_cast_test_where_cast_string_postgres.yaml', transport)
@classmethod
def dir(cls):
return 'queries/graphql_query/boolexp/basic'