This repository was archived by the owner on Jan 28, 2026. It is now read-only.
Merged
Conversation
643282c to
8307bf2
Compare
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
Signed-off-by: avichalp <hi@avichalp.me>
8307bf2 to
d1018fd
Compare
avichalp
commented
Nov 28, 2023
| c.column_name, | ||
| pg_catalog.format_type(t.oid, NULL) AS full_data_type | ||
| FROM information_schema.columns AS c | ||
| JOIN pg_catalog.pg_type AS t ON c.udt_name = t.typname |
Contributor
Author
avichalp
commented
Nov 28, 2023
| // pgToDDBType maps a PG type to a duckdb type. | ||
| func (dbm *DBManager) pgToDDBType(typ string) (duckdbType, error) { | ||
| // handle character(N), character varying(N), numeric(N, M) | ||
| if strings.HasSuffix(typ, ")") { |
Contributor
Author
There was a problem hiding this comment.
Handle edge cases and finds appropriate type from typeConversionMap
Contributor
There was a problem hiding this comment.
suggestion: use strings.Cut, instead of strings.Split. example: https://go.dev/play/p/J4OwaJGJqyB
avichalp
commented
Nov 28, 2023
| // typeConversionMap maps PG types to duckdb types. | ||
| // currently, only a subset of PG types are supported. | ||
| // Custom enum types, sturcts, multi-dimensional arrays are not supported. | ||
| var typeConversionMap = map[string]duckdbType{ |
Contributor
Author
There was a problem hiding this comment.
PG type is mapped to a DuckDB type and a transform function that will transform the column value from the WAL JSON into value that can be used in the Duck DB query.
brunocalza
approved these changes
Nov 30, 2023
Contributor
brunocalza
left a comment
There was a problem hiding this comment.
Nice work! Looks like you exhaustively tested all types, really nice. Looks good to me! Could not find any problem, lmk if you need help with manual tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

This pull request introduces type conversion between Postgres and DuckDB. Most of the Postgres data types are mapped to equivalent DuckDB but there are three exceptions. The following types are not supported in this PR but can be added later.