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! 👍
Hey!
My use-case for
pg-structure(viapg-generator) includes essentially being able to write out fully-validCREATE TABLEstatements for a given running database. Part of that involves writing out the correspondingCREATE INDEXstatements.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",tomodule-files/sql/9/index.sqlthen I should be able to receive the fullCREATE INDEXstatement. (e.g. Returning something likecreateIndexExpression | 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! 👍