# gizmodel/sql/parsecatalog

The SQL parser: catalog objects, event triggers, publications and DROP.

```gizlang
import * as Parsecatalog from "gizmodel/sql/parsecatalog";
```

## Methods

### `Parser.tableQuery`

```gizlang
function Parser.tableQuery(self: mut Parser, s: mut Statement): void
```

CREATE TABLE ... AS's query: a SELECT, or EXECUTE name(args) of a prepared statement (in `inner`; the server puts the
statement in), then WITH [NO] DATA.

Effects: fail, read, alloc.

### `Parser.catalogObject`

```gizlang
function Parser.catalogObject(self: mut Parser, verb: string, kind: string): Statement
```

CREATE, ALTER or DROP (`verb`) of a catalog object of `kind` (catalogKind): op "catalog". `name`,
DROP's further names in `columns`, RENAME TO's new name in `columns`, the definition in `text`;
the tables it names (CREATE STATISTICS ... FROM t) in `inherits`; a publication by Parser.publication.

Effects: fail, read, alloc.

### `Parser.alterSequence`

```gizlang
function Parser.alterSequence(self: mut Parser): Statement
```

ALTER SEQUENCE: op "alter_sequence"; `columns` holds the changes as key=value (restart, start, increment,
minvalue, maxvalue, cycle, as; an empty value is the default), or `action` rename with the new name in `text`.

Effects: fail, alloc.

### `Parser.roleNames`

```gizlang
function Parser.roleNames(self: mut Parser): Vec<string>
```

Role names separated by commas, lower case unless quoted.

Effects: fail, alloc.

### `Parser.drop`

```gizlang
function Parser.drop(self: mut Parser): Statement
```

Effects: fail, read, alloc.

### `Parser.ownerTo`

```gizlang
function Parser.ownerTo(self: Parser): string
```

The role of a trailing OWNER TO r, lower case unless quoted; "" when there is none or it is the current role.

Effects: fail, alloc.

