Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Add support for additonal types which are created via extensions e.g Geospatial objects. #139

Closed
wants to merge 3 commits into from

Conversation

bettdouglas
Copy link

@bettdouglas bettdouglas commented Jul 12, 2020

This request is in accordance to #130 (comment). After doing some searching, types created by CREATE EXTENSION extension_name are dynamic and are not static unlike datatypes fully supported by postgres. The only way to get their type_id and typeString is to query the pg_types table in postgres.

This will enable people to extend the library easily once they have a way of decoding and encoding the data types from dart objects to pg_type as well as from the types in postgres to dart objects.

This change will enable adding extra types from

Adding a new type:

  1. add item to this enumeration
  2. update all switch statements on this type
  3. add pg type code -> enumeration item in PostgresBinaryDecoder.typeMap (lookup type code: https://doxygen.postgresql.org/include_2catalog_2pg__type_8h_source.html)
  4. add identifying key to PostgreSQLFormatIdentifier.typeStringToCodeMap.

to

Adding a new type:

  1. add item to this enumeration
  2. update all switch statements on this type
  3. add identifying key to PostgreSQLFormatIdentifier.typeStringToCodeMap.
  4. Add decoders and encoders for this new data type

If PR is accepted, support for geospatial objects using extension https://postgis.net and queries is already using this feature is implemented with some tests on this branch https://github.com/bettdouglas/postgresql-dart/tree/geospatial-support which closes
stablekernel/aqueduct#747
stablekernel/aqueduct#634
#120

The query_reuse_test.dart is failing though. I may need help fixing that.

@bettdouglas bettdouglas changed the title Add support for addiitonal types which are created via extensions e.g Geospatial objects. [Enhancement] Add support for addiitonal types which are created via extensions e.g Geospatial objects. Jul 12, 2020
'''
select oid::int,typname from pg_type where typname in ('text','int2','int4','int8','float4','float8','bool','date','bytea', 'timestamp','timestamptz','jsonb','name','uuid');
''',
allowReuse: false,
Copy link
Author

Choose a reason for hiding this comment

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

After adding this, the allow_reuse_test passes.

@bettdouglas
Copy link
Author

On my local machine, on my local postgres 12, all checks are passing but on Travis which is 9.6, some checks are not passing

@bettdouglas
Copy link
Author

After testing with a docker image in 9.6, all checks are passing. I'm not sure why the tests are failing on Travis

@bettdouglas bettdouglas changed the title [Enhancement] Add support for addiitonal types which are created via extensions e.g Geospatial objects. [Enhancement] Add support for additonal types which are created via extensions e.g Geospatial objects. Jul 28, 2020
@bettdouglas
Copy link
Author

@isoos @stablekernel-admin @joeconwaystk can anyone kindly review this and give some feedback?

@isoos
Copy link
Collaborator

isoos commented Sep 6, 2022

@bettdouglas: the package's main repository is now at https://github.com/isoos/postgresql-dart
I'm not sure if this PR is still easy to port, as it has diverged a bit...

@bettdouglas
Copy link
Author

bettdouglas commented Sep 6, 2022

I think its the PR is too outdated. I'll just close it and try something fresh from the new repository.

I was browsing through old projects and when merging upstream changes(null safety), it pushed & pulled upstream changes.

@bettdouglas bettdouglas closed this Sep 6, 2022
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