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

server/db/driver/pg: log postgres notices #1226

Merged
merged 2 commits into from Oct 14, 2021
Merged

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Sep 29, 2021

This updates the postgresql driver, lib/pq, from 1.2.0 to 1.10.3. This contains no breaking changes. It is primarily some bug fixes, also a few context enabled methods, new array types, and support for handling postgres notices.

Notices from postgres are now handled by logging them according to their severity and error code class using the new pq.ConnectorWithNoticeHandler Connector factory function. There is some ambiguity in severity levels, but this will at least log anything important that was previously ignored.

'pgonline' tests are still passing.

In addition to the pq update and notice logging, remove an old pseudo-upgrade.

This pseudo-upgrade was added prior to the first release and prior to schema versioning that would create the matches.forgiven column if it does not exist. It has existed in the CREATE TABLE statement since first release so this ALTER TABLE is always a no-op that just results in a logged NOTICE:

[DBG] DB: pq: NOTICE (42701) - duplicate_column: column "forgiven" of relation "matches" already exists, skipping

The comments around this indicate the same, that this should have been removed when actual upgrades were implemented. Schema v1 does indeed include this forgiven column, and this change can thus remove the ALTER TABLE statement that tries to re-add it on every startup.

The forgiven column was on v0.1.0: 73d04b4

@chappjc chappjc added this to the 0.4 milestone Sep 29, 2021
Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

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

Looks good. Please run a go mod tidy on loadbot.

This updates the postgresql driver, lib/pq, from 1.2.0 to 1.10.3.
This contains no breaking changes.  It is primarily some bug fixes,
also a few context enabled methods, new array types, and support for
handling postgres notice/notification handlers.

Notices from postgres are now handled by logging them according
to their severity and error code class using the new
pq.ConnectorWithNoticeHandler Connector factory function.
There is some ambiguity in severity levels, but this will at least log
anything important that was previously ignored.

'pgonline' tests are still passing.

This also bumps the golangci-lint version to 1.42.1, which is the first
version built from Go 1.17 and thus follows the new go fmt rules:
https://golang.org/doc/go1.17#gofmt
A pseudo-upgrade was added prior to the first release and prior to
schema versioning that would create the matches.forgiven column
if it does not exist.  It has existed in the CREATE TABLE statement
since first release so this ALTER TABLE is always a no-op that just
results in a logged NOTICE:

[DBG] DB: pq: NOTICE (42701) - duplicate_column: column "forgiven" of relation "matches" already exists, skipping

The comments around this indicate the same, that this should have been
removed when actual upgrades were implemented. Schema v1 does
indeed include this forgiven column, and this change can thus remove
the ALTER TABLE statement that tries to re-add it on every startup.
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.

None yet

3 participants