You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2023/01/13 01:27:06 UTC
[GitHub] [shardingsphere] TeslaCN opened a new issue, #23537: Create a TypeCastExpressionSegment to unify PostgreSQL/openGauss type cast syntax
TeslaCN opened a new issue, #23537:
URL: https://github.com/apache/shardingsphere/issues/23537
## Refactor
There are various PostgreSQL/openGauss type cast syntax:
https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-GENERIC
Consider creating a `TypeCastExpressionSegment` to unify the SQL parse result.
Example:
```sql
select CAST(money '1' as varchar)::char(10)
```
Parse result of PostgreSQL
```json
{
"version": 150001,
"stmts": [
{
"stmt": {
"SelectStmt": {
"targetList": [
{
"ResTarget": {
"val": {
"TypeCast": {
"arg": {
"TypeCast": {
"arg": {
"TypeCast": {
"arg": {
"A_Const": {
"sval": {
"sval": "1"
},
"location": 18
}
},
"typeName": {
"names": [
{
"String": {
"sval": "money"
}
}
],
"typemod": -1,
"location": 12
},
"location": -1
}
},
"typeName": {
"names": [
{
"String": {
"sval": "pg_catalog"
}
},
{
"String": {
"sval": "varchar"
}
}
],
"typemod": -1,
"location": 25
},
"location": 7
}
},
"typeName": {
"names": [
{
"String": {
"sval": "pg_catalog"
}
},
{
"String": {
"sval": "bpchar"
}
}
],
"typmods": [
{
"A_Const": {
"ival": {
"ival": 10
},
"location": 40
}
}
],
"typemod": -1,
"location": 35
},
"location": 33
}
},
"location": 7
}
}
],
"limitOption": "LIMIT_OPTION_DEFAULT",
"op": "SETOP_NONE"
}
}
}
]
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu closed issue #23537: Create a TypeCastExpressionSegment to unify PostgreSQL/openGauss type cast syntax
Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #23537: Create a TypeCastExpressionSegment to unify PostgreSQL/openGauss type cast syntax
URL: https://github.com/apache/shardingsphere/issues/23537
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org