hasura / hasura/graphql-engine
Column Presets fail when setting a bit column in sql-server
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.2.0
CLI Version (for CLI related issue): 2.2.0
### Environment
Core, running in a docker container.
### What is the expected behaviour?
When setting a column preset for a bit column, I can type in `true` or `false` to indicate a boolean value.
### Keywords
sql server, column presets, boolean
### What is the current behaviour?
An error is produced as indicated in the screen shots
### How to reproduce the issue?
1. Set a column preset for a bit column
2. Set the column preset value to `true` or `false`
I tried using `0` or `1` and this produced the same issue. It seems like perhaps the yaml file wants it to not be in quotes and to be an actual int/number judging by the error message that says "Expected Number".
### Screenshots or Screencast


### Please provide any traces or logs that could help here.
This is the "Detail" from the error
```
[
{
"definition": {
"role": "user",
"source": "ANSWR_DB",
"comment": null,
"permission": {
"backend_only": false,
"set": {
"Subject": "Message",
"InitiatedBy": "x-hasura-User-Id",
"DisableRecipientReplies": "false"
},
"check": {
"InitiatedBy": {
"_eq": "X-Hasura-User-Id"
}
},
"columns": [
"CategoryId",
"CreatedOn",
"DisableRecipientReplies",
"DisableReplyAlerts",
"LastMessageSentOn",
"PatientId",
"ReplyAlertsInitiatorOnly",
"Subject",
"UpdatedOn"
]
},
"table": {
"schema": "Messaging",
"name": "Conversation"
}
},
"reason": "Inconsistent object: in table \"Messaging.Conversation\": in permission for role \"user\": parsing Word8 failed, expected Number, but encountered String",
"name": "insert_permission user in table Messaging.Conversation in source ANSWR_DB",
"type": "insert_permission"
}
]
```
### Any possible solutions?
None so far, just avoid using column presets for a bit column!
### Can you identify the location in the source code where the problem exists?
Not so far, looked around for the permissions code/components but haven't found it yet.
### If the bug is confirmed, would you be willing to submit a PR?
Perhaps if I have time. I do have background in ts/react. If a team member can point me to the code for permissions/column presets, I assume it should be pretty easy.
Contributor guide
Research direction
Start by reproducing the issue with a SQL Server bit column and a column preset set to true, false, 0, or 1. Trace the permissions and column-presets entry points to find where the preset value is parsed as a number. Done means valid boolean or numeric bit values are accepted without the “Expected Number” error, with a regression test if the relevant test location is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- authorization, backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100