-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add pgx driver package #517
Merged
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
995cc27
replace lib/pq dependency with pgx in postgres driver
dzbee 420fede
fix pgx error handling
dzbee 0abe9fc
update postgres tests to use pgx driver and error reporting
dzbee 7f32fe6
update quoteIdentifier implementation to match lib/pq
dzbee 6c61cf3
move changes for pgx support into new driver package
dzbee 98447ca
add pgx driver to CLI
dzbee 2afbd8d
restore examples used in testing for pgx driver
dzbee db16491
replace postgres driver name with pgx in DSN in tests and docs
dzbee 611d4d1
consolidate connection string formatting in pgx testing
dzbee def44ba
lock pgx package at v4
dzbee d6e4514
update parsed URL scheme instead of using string operation
dzbee f2fa789
add pgx for builds using make
dzbee 84b6e46
add pgx to top level docs
dzbee 42470f2
remove autogenerated TOC
dzbee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# postgres | ||
|
||
`postgres://user:password@host:port/dbname?query` (`postgresql://` works, too) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the DSN |
||
|
||
| URL Query | WithInstance Config | Description | | ||
|------------|---------------------|-------------| | ||
| `x-migrations-table` | `MigrationsTable` | Name of the migrations table | | ||
| `x-statement-timeout` | `StatementTimeout` | Abort any statement that takes more than the specified number of milliseconds | | ||
| `x-multi-statement` | `MultiStatementEnabled` | Enable multi-statement execution (default: false) | | ||
| `x-multi-statement-max-size` | `MultiStatementMaxSize` | Maximum size of single statement in bytes (default: 10MB) | | ||
| `dbname` | `DatabaseName` | The name of the database to connect to | | ||
| `search_path` | | This variable specifies the order in which schemas are searched when an object is referenced by a simple name with no schema specified. | | ||
| `user` | | The user to sign in as | | ||
| `password` | | The user's password | | ||
| `host` | | The host to connect to. Values that start with / are for unix domain sockets. (default is localhost) | | ||
| `port` | | The port to bind to. (default is 5432) | | ||
| `fallback_application_name` | | An application_name to fall back to if one isn't provided. | | ||
| `connect_timeout` | | Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely. | | ||
| `sslcert` | | Cert file location. The file must contain PEM encoded data. | | ||
| `sslkey` | | Key file location. The file must contain PEM encoded data. | | ||
| `sslrootcert` | | The location of the root certificate file. The file must contain PEM encoded data. | | ||
| `sslmode` | | Whether or not to use SSL (disable\|require\|verify-ca\|verify-full) | | ||
|
||
|
||
## Upgrading from v1 | ||
|
||
1. Write down the current migration version from schema_migrations | ||
1. `DROP TABLE schema_migrations` | ||
2. Wrap your existing migrations in transactions ([BEGIN/COMMIT](https://www.postgresql.org/docs/current/static/transaction-iso.html)) if you use multiple statements within one migration. | ||
3. Download and install the latest migrate version. | ||
4. Force the current migration version with `migrate force <current_version>`. | ||
|
||
## Multi-statement mode | ||
|
||
In PostgreSQL running multiple SQL statements in one `Exec` executes them inside a transaction. Sometimes this | ||
dhui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
behavior is not desirable because some statements can be only run outside of transaction (e.g. | ||
`CREATE INDEX CONCURRENTLY`). If you want to use `CREATE INDEX CONCURRENTLY` without activating multi-statement mode | ||
you have to put such statements in a separate migration files. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to pgx