/// <summary> /// Parses CREATE SCHEMA statement. /// </summary> public static void Parse(PgDatabase database, string statement) { var parser = new Parser(statement); parser.Expect("CREATE", "SCHEMA"); if (parser.ExpectOptional("AUTHORIZATION")) { var schema = new PgSchema(ParserUtils.GetObjectName(parser.ParseIdentifier())); database.AddSchema(schema); schema.Authorization = schema.Name; var definition = parser.Rest(); if (definition != null && definition.Length > 0) { schema.Definition = definition; } } else { var schema = new PgSchema(ParserUtils.GetObjectName(parser.ParseIdentifier())); database.AddSchema(schema); if (parser.ExpectOptional("AUTHORIZATION")) { schema.Authorization = ParserUtils.GetObjectName(parser.ParseIdentifier()); } var definition = parser.Rest(); if (definition != null && definition.Length > 0) { schema.Definition = definition; } } }