Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Upgrade to modules, pgx/v4 & accoutrements - WIP #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattTruebill
Copy link

Upgrade to using go modules.

Upgrade to pgx/4.

if cfg.Postgres.Host == "" {
cfg.Postgres.Host = defaultPostgresHost
}

Copy link
Author

Choose a reason for hiding this comment

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

pgx/v4 favors taking pg connection as input via a connection string in either url or dsn format.

conn *pgx.ReplicationConn
dbCfg pgx.ConnConfig
conn *pgconn.PgConn
dbCfg pgconn.Config
Copy link
Author

Choose a reason for hiding this comment

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

Lots of changes like this where will now be referencing repos that were spun-out of the main pgx repo as of version 4.


}
default:
log.Printf("Received unexpected message: %#v\n", repMsg)
Copy link
Author

Choose a reason for hiding this comment

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

This is copypasta from an example in pglogrepl and could use careful review.

@@ -111,7 +111,7 @@ func (r *Replicator) newTable(tblName config.PgTableName, tblConfig config.Table
func (r *Replicator) checkPgSlotAndPub(tx *pgx.Tx) error {
var slotExists, pubExists bool

err := tx.QueryRow("select "+
err := (*tx).QueryRow(r.ctx, "select "+
Copy link
Author

Choose a reason for hiding this comment

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

Lots of changes like this (tx => *tx) now that go doesn't automatically dereference pointers to interfaces.

@EugeneKovalev
Copy link

@mkabilov @mattTruebill any news on this?

I am not able to install pg2ch. Right now I am getting this:

go get -u github.com/mkabilov/pg2ch

# github.com/mkabilov/pg2ch/pkg/utils/kvstorage
go/pkg/mod/github.com/mkabilov/pg2ch@v1.0.0/pkg/utils/kvstorage/diskv.go:52:41: s.storage.ReadString undefined (type *diskv.Diskv has no field or method ReadString)
go/pkg/mod/github.com/mkabilov/pg2ch@v1.0.0/pkg/utils/kvstorage/diskv.go:60:18: s.storage.WriteString undefined (type *diskv.Diskv has no field or method WriteString)

@buildscientist
Copy link

Hello @mkabilov and @mattTruebill - thanks for your hard work on this project.

Do either of you have an ETA when this PR will be pulled in? I have an outstanding issue where pg2ch will not handle DateTime64 CH fields due to the underlying ch-go library not supporting them. This has been fixed in the current version of clickhouse-go which is being pulled in via gomod dependency management.

@buildscientist
Copy link

@EugeneKovalev

You can clone the repository and build locally. Until this PR Is merged go get will not work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants