Skip to content

Include "CREATE INDEX" statement on Index class #96

@jsau-

Description

@jsau-

Hey!

My use-case for pg-structure (via pg-generator) includes essentially being able to write out fully-valid CREATE TABLE statements for a given running database. Part of that involves writing out the corresponding CREATE INDEX statements.

While I can currently get access to parts of the index definition via table.indexes (e.g. its name, the partial index expression, etc.), parts like its method, e.g. USING btree, don't seem to be exposed via the library at present.

It looks like if I were to add e.g. pg_get_indexdef(ix.indexrelid) AS "createIndexExpression", to module-files/sql/9/index.sql then I should be able to receive the full CREATE INDEX statement. (e.g. Returning something like createIndexExpression | CREATE UNIQUE INDEX foo ON bar.baz USING btree (qux, quz))

I'd be happy to look at putting a pull request for this if that's something you'd be open to accepting into the library (provided I've not missed anything obvious that already exposes the information I'm looking for), or by handling it in any other way you'd prefer.

Cheers! 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions