MCPcopy
hub / github.com/sqldef/sqldef / TestNowFunctionInDefaultExpression

Function TestNowFunctionInDefaultExpression

parser/parser_test.go:495–507  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

493}
494
495func TestNowFunctionInDefaultExpression(t *testing.T) {
496 sql := "CREATE TABLE test (pk timestamp primary key default now())"
497
498 statement, err := ParseDDL(sql, ParserModePostgres)
499 if err != nil {
500 t.Fatalf("failed to parse NOW() default expression: %v", err)
501 }
502
503 got := String(statement)
504 if got != "create table test (\n\tpk timestamp default(now()) primary key\n)" {
505 t.Fatalf("unexpected normalized SQL:\n%s", got)
506 }
507}
508
509// TestTypeKeywordsAsIndexColumns tests that type keywords (uuid, int, bigint, etc.)
510// can be used as unquoted column names in index definitions

Callers

nothing calls this directly

Calls 3

ParseDDLFunction · 0.85
StringFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected