Skip over dropped attributes when enumerating types #492
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pg_attribute
may contain records for attributes that were dropped but Postgres kept them around and instead of deleting them, renamed them to........pg.dropped.#........
and set theirattisdropped
totrue
.This ends up generating these dropped attributes as
unknown
fields in the TypeScript types.In this commit I updated the
types
query to not return these.Maybe it would be preferrable to instead keep these but skip them only when generating the TypeScript types?
What kind of change does this PR introduce?
Feature? Maybe bug fix?
It is arguable whether these dropped attributes should appear in the generated types and be accessible via the Postgres Meta API. I expect folks might lean towards exposing them instead of skipping them. In this case I'd like to contribute a change which adds a new
dropped
boolean field ontypes
and then skips overdropped
types when generating composite types via the TypeScript generator.What is the current behavior?
Dropped attributes appear in generated TypeScript types.
It used to be that they would appear just as a line saying
unknown;
.This seems to have been fixed on
master
, not they actually display the renamed name:See #483 for the PR that fixed this.
Yet these are not useful in the types since they are dropped and I happen to think they shouldn't be in the TypeScript types. It is arguable whether they should be in
pgMeta.types.list
. I can see an argument for both cases.What is the new behavior?
pgMeta.types.list
skips overattisdropped=true
attributes.As a result, the TypeScript types skip over them as well when generating composite types (among other types?).
I am happy to change the PR to instead skip over these at the TypeScript generator level so they remain accessible in
pgMeta.types.list
.