-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support Case Sensitive Schemas #624
Conversation
16f7be2
to
2ea5e7a
Compare
@@ -0,0 +1,30 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a helpful file for resetting the local PG database if it's ever out of sync with local hasura at any point.
Usage is: Run this script, then run hasura deploy
from the hasura folder.
I'll be making progress across PRs to make local testing easier to start up on and work with.
bf75b0c
to
bc1f339
Compare
I tested with the following schema and verified upsert works. Previously, we would get "relation does not exist" errors.
|
@@ -120,7 +125,7 @@ export default class Indexer { | |||
// TODO: Prevent unnecesary reruns of set status | |||
const resourceCreationSpan = this.tracer.startSpan('prepare vm and context to run indexer code'); | |||
simultaneousPromises.push(this.setStatus(functionName, blockHeight, 'RUNNING')); | |||
const vm = new VM({ timeout: 20000, allowAsync: true }); | |||
const vm = new VM({ allowAsync: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the timeout as it doesn't even work with async code anyway, right now. I'm also hoping removing the timeout resolves the issues where Pavel's bitmap_v2 indexer is not being traced.
I'll monitor this change and revert it if I need to.
} | ||
|
||
private retainOriginalQuoting (schema: string, tableName: string): string { | ||
const createTableQuotedRegex = `\\b(create|CREATE)\\s+(table|TABLE)\\s+"${tableName}"\\s*`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex just looks for a create table statement which uses the quoted tableName. If we find a match, the tableName was quoted.
@@ -0,0 +1,13 @@ | |||
// Run with 'npx ts-node src/test-client.ts' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added typescript examples as well since they're tried to the proto file in the runner folder, and I find messing with them a bit easier.
0b343a7
to
59e2d1d
Compare
Indexer schemas can have quoted or unquoted table & column names. However, QueryApi always quotes table names and does not quote column names during SQL query construction for context.db. This is because the AST generated form parsing the schema does not include if the identifier was quoted or not. However, recent updates tot he parsing library has added this functionality in.
I've updated QueryApi to quote both the table name and the column names if they were quoted originally, and leave them unquoted otherwise.
In addition, I've replaced kevin-node-sql-parser back with the original package now that the 5.0 update has released. I've also added a typscript examples folder for convenience, as well as a script to clear the local postgres database.