Skip to content

Conversation

@NinoFloris
Copy link
Member

Some work that I didn't want to put into #5123

Related to #4949.
Though not because of as reflection free mode is essentially unsupported.

It would expand our minimal set slightly too as previously we didn't import range array types or multirange array types, they weren't specified.

@NinoFloris NinoFloris force-pushed the remove-attribute-reflection branch 5 times, most recently from 750aaa3 to 7a68fd6 Compare November 6, 2023 15:35
@NinoFloris
Copy link
Member Author

NinoFloris commented Nov 6, 2023

Folding all data into the MinimalDatabaseInfo reduces our binary size by a small amount (4kb) and reduces our reliance on reflection, probably worth it.

@NinoFloris NinoFloris marked this pull request as ready for review November 6, 2023 15:36
@NinoFloris NinoFloris changed the title Remove attribute reflection Remove BuiltInPostgresType attribute reflection Nov 6, 2023
@NinoFloris NinoFloris force-pushed the remove-attribute-reflection branch from 7a68fd6 to 07a3fd5 Compare November 8, 2023 14:57
@NinoFloris NinoFloris added this to the 8.0.0 milestone Nov 9, 2023
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty straightforward, thanks!

In the future, we can consider making PgMinimalDatabaseInfo a programmatic opt-in, rather than the current connection string. This would allow it to get trimmed if not used, and goes in the direction of at least moving non-environmental options out of the connection string.

@@ -0,0 +1,21 @@
namespace Npgsql.PostgresTypes;

enum PostgresTypeKind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer to keep the PgTypeKind naming for the succinctness.. I'd actually consider going in the other direction and rename other types prefixed with Postgres to Pg (e.g. PgMinimalDatabaseInfo)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed it to fit in with the other Postgres* types in here. I agree Pg is nice and succinct but we can't rename the others (since they're public) so I went with Postgres for consistency.

@NinoFloris
Copy link
Member Author

In the future, we can consider making PgMinimalDatabaseInfo a programmatic opt-in, rather than the current connection string

We can try but we're using it unconditionally as a bootstrap type catalog to go from datatypenames in the resolvers to pgtypeid oids. I think we'll always need such a minimal map available.

@NinoFloris NinoFloris force-pushed the remove-attribute-reflection branch from 07a3fd5 to e4ecf91 Compare November 14, 2023 17:23
@NinoFloris NinoFloris merged commit 3541129 into main Nov 14, 2023
@NinoFloris NinoFloris deleted the remove-attribute-reflection branch November 14, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants