stripCreateOrReplaceTable detects `CREATE OR REPLACE TABLE ...`. On a match it returns the PostgreSQL-parseable `CREATE TABLE ...` form (with OR REPLACE removed) and ok=true; the caller transpiles that through the normal pipeline and then restores OR REPLACE via reinjectOrReplace. Returns ok=false f
(sql string)
| 30 | // and then restores OR REPLACE via reinjectOrReplace. Returns ok=false for any |
| 31 | // other statement (including the PostgreSQL-valid `CREATE OR REPLACE VIEW`). |
| 32 | func stripCreateOrReplaceTable(sql string) (inner string, ok bool) { |
| 33 | m := createOrReplaceTableRe.FindStringSubmatch(stripLeadingSQL(sql)) |
| 34 | if m == nil { |
| 35 | return "", false |
| 36 | } |
| 37 | return "CREATE " + m[1], true |
| 38 | } |
| 39 | |
| 40 | // reinjectOrReplace inserts `OR REPLACE` after the leading CREATE keyword of a |
| 41 | // transpiled `CREATE [TEMP] TABLE ...` statement, reversing the strip done by |
no test coverage detected