github.com/lib/pq
go
pkg:golang/github.com/lib/pq
404 Dependabot PRs
7 days ago
278 repositories
15 repositories
Recent PRs
Bump the go-modules group across 1 directory with 11 updates
Bump the go-modules group in /app with 22 updates
LibanIsse/memos-on-fargate #23
chore(deps): bump the go-deps group across 1 directory with 47 updates
michael-angelo-guban/go-ruder-server #80
chore(deps): bump the gomod-vault-adapter-minor-patch group across 1 directory with 3 updates
deps: Bump github.com/lib/pq from 1.11.2 to 1.12.3
jordigilh/kubernaut #1137
Bump the go-modules group in /app with 22 updates
LibanIsse/memos-on-fargate #18
build(deps): Bump the subscription-go-deps group across 1 directory with 5 updates
build(deps): bump github.com/lib/pq from 1.10.9 to 1.12.3 in /backend
senran-N/SRapi #36
fix(deps): bump the external group across 1 directory with 19 updates
opentdf/platform #3452
build(deps): bump github.com/lib/pq from 1.10.9 to 1.12.3
elastic/beats #50538
build(deps): Bump the policy-go-deps group across 1 directory with 6 updates
chore(deps): bump the go-minor-patch group across 1 directory with 2 updates
fix(deps): bump the external group across 1 directory with 21 updates
opentdf/platform #3431
go(games-backend): bump the games-backend-deps group across 1 directory with 3 updates
chore(deps): bump the go group across 3 directories with 24 updates
hashicorp/boundary #6680
chore(deps)(deps): bump github.com/lib/pq from 1.10.9 to 1.12.3 in /workspace-server
Molecule-AI/molecule-core #2519
chore(deps): bump the go-deps group across 1 directory with 19 updates
fix(deps): bump github.com/lib/pq from 1.12.2 to 1.12.3 in /api
NdoleStudio/httpsms #867
build(deps): Bump github.com/lib/pq from 1.10.4 to 1.12.3
bdengine/bde-tendermint #1014
chore(deps): bump github.com/lib/pq from 1.10.9 to 1.12.3 in /services/coordinator
chore(deps): bump the go-deps group across 1 directory with 49 updates
Blitzy-Sandbox/blitzy-RudderStack #36
fix(deps): bump the external group across 1 directory with 19 updates
opentdf/platform #3375
build(deps): Bump the minor-updates group across 1 directory with 3 updates
chore(deps)(deps): bump the minor-patch group across 1 directory with 4 updates
hidatara-ds/evolipia-radar #75
chore(deps)(deps): bump the minor-and-patch group in /src/backend/api with 6 updates
fix(deps): bump the external group across 1 directory with 19 updates
opentdf/platform #3314
deps(deps): bump the go-dependencies group across 1 directory with 26 updates
Bump github.com/lib/pq from 1.10.9 to 1.12.3 in /services/worker
fix(deps): bump the external group across 1 directory with 18 updates
opentdf/platform #3302
build(deps): bump github.com/lib/pq from 1.11.2 to 1.12.3 in /backend
build(deps): bump the minor-and-patch group across 1 directory with 7 updates
OFFIS-RIT/kiwi #260
Bump github.com/lib/pq from 1.10.9 to 1.12.3 in /receiver/sqlqueryreceiver
coralogix/opentelemetry-collector-contrib-old-fork #39442
chore(deps): bump the go group across 3 directories with 20 updates
hashicorp/boundary #6586
build(deps): Bump github.com/lib/pq from 1.10.9 to 1.12.3 in /services/patient-service
taotao19950405/resmed-platform-dashboard #34
chore(deps): bump the go-deps group with 3 updates
italia/developers-italia-api #323
chore(deps): bump the go-dependencies group across 1 directory with 20 updates
dev: bump the safe group across 1 directory with 42 updates
TheThingsNetwork/lorawan-stack #7880
build(deps): bump github.com/lib/pq from 1.12.1 to 1.12.3
telhawk-systems/telhawk-proxy #72
deps: Bump github.com/lib/pq from 1.10.9 to 1.12.3
deps: bump the minor-patch group with 11 updates
build(deps): bump the backend group in /backend with 16 updates
GenerateNU/toggo #268
deps(go): bump github.com/lib/pq from 1.11.2 to 1.12.3
tobiasehlert/teslamateapi #473
build(deps): Bump github.com/lib/pq from 1.12.0 to 1.12.3
celestiaorg/celestia-core #2907
chore(deps)(deps): bump the go-dependencies group across 1 directory with 19 updates
chore(deps): bump the go-backend-minor-patch group in /kubilitics-backend with 26 updates
deps(deps): bump github.com/lib/pq from 1.11.1 to 1.12.3
Bump github.com/lib/pq from 1.12.2 to 1.12.3
RedHatInsights/ccx-notification-service #1085
Bump github.com/lib/pq from 1.12.2 to 1.12.3
chore(deps): bump github.com/lib/pq from 1.12.0 to 1.12.3
guyinwonder168/database-mcp-server #56
build(deps): Bump github.com/lib/pq from 1.10.6 to 1.12.3
Package Details
| Name: | github.com/lib/pq |
| Ecosystem: | go |
| PURL Type: | golang |
| Package URL: | pkg:golang/github.com/lib/pq |
| JSON API: | View JSON |
Package Information
Package pq is a pure Go Postgres driver for the database/sql package. In most cases clients will use the database/sql package instead of using this package directly. For example: You can also connect to a database using a URL. For example: Similarly to libpq, when establishing a connection using pq you are expected to supply a connection string containing zero or more parameters. A subset of the connection parameters supported by libpq are also supported by pq. Additionally, pq also lets you specify run-time parameters (such as search_path or work_mem) directly in the connection string. This is different from libpq, which does not allow run-time parameters in the connection string, instead requiring you to supply them in the options parameter. For compatibility with libpq, the following special connection parameters are supported: Valid values for sslmode are: See http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING for more information about connection string parameters. Use single quotes for values that contain whitespace: A backslash will escape the next character in values: Note that the connection parameter client_encoding (which sets the text encoding for the connection) may be set but must be "UTF8", matching with the same rules as Postgres. It is an error to provide any other value. In addition to the parameters listed above, any run-time parameter that can be set at backend start time can be set in the connection string. For more information, see http://www.postgresql.org/docs/current/static/runtime-config.html. Most environment variables as specified at http://www.postgresql.org/docs/current/static/libpq-envars.html supported by libpq are also supported by pq. If any of the environment variables not supported by pq are set, pq will panic during connection establishment. Environment variables have a lower precedence than explicitly provided connection parameters. The pgpass mechanism as described in http://www.postgresql.org/docs/current/static/libpq-pgpass.html is supported, but on Windows PGPASSFILE must be specified explicitly. database/sql does not dictate any specific format for parameter markers in query strings, and pq uses the Postgres-native ordinal markers, as shown above. The same marker can be reused for the same parameter: pq does not support the LastInsertId() method of the Result type in database/sql. To return the identifier of an INSERT (or UPDATE or DELETE), use the Postgres RETURNING clause with a standard Query or QueryRow call: For more details on RETURNING, see the Postgres documentation: For additional instructions on querying see the documentation for the database/sql package. Parameters pass through driver.DefaultParameterConverter before they are handled by this package. When the binary_parameters connection option is enabled, []byte values are sent directly to the backend as data in binary format. This package returns the following types for values from the PostgreSQL backend: All other types are returned directly from the backend as []byte values in text format. pq may return errors of type *pq.Error which can be interrogated for error details: See the pq.Error type for details. You can perform bulk imports by preparing a statement returned by pq.CopyIn (or pq.CopyInSchema) in an explicit transaction (sql.Tx). The returned statement handle can then be repeatedly "executed" to copy data into the target table. After all data has been processed you should call Exec() once with no arguments to flush all buffered data. Any call to Exec() might return an error which should be handled appropriately, but because of the internal buffering an error returned by Exec() might not be related to the data passed in the call that failed. CopyIn uses COPY FROM internally. It is not possible to COPY outside of an explicit transaction in pq. Usage example: PostgreSQL supports a simple publish/subscribe model over database connections. See http://www.postgresql.org/docs/current/static/sql-notify.html for more information about the general mechanism. To start listening for notifications, you first have to open a new connection to the database by calling NewListener. This connection can not be used for anything other than LISTEN / NOTIFY. Calling Listen will open a "notification channel"; once a notification channel is open, a notification generated on that channel will effect a send on the Listener.Notify channel. A notification channel will remain open until Unlisten is called, though connection loss might result in some notifications being lost. To solve this problem, Listener sends a nil pointer over the Notify channel any time the connection is re-established following a connection loss. The application can get information about the state of the underlying connection by setting an event callback in the call to NewListener. A single Listener can safely be used from concurrent goroutines, which means that there is often no need to create more than one Listener in your application. However, a Listener is always connected to a single database, so you will need to create a new Listener instance for every database you want to receive notifications in. The channel name in both Listen and Unlisten is case sensitive, and can contain any characters legal in an identifier (see http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS for more information). Note that the channel name will be truncated to 63 bytes by the PostgreSQL server. You can find a complete, working example of Listener usage at https://godoc.org/github.com/lib/pq/example/listen. If you need support for Kerberos authentication, add the following to your main package: This package is in a separate module so that users who don't need Kerberos don't have to download unnecessary dependencies. When imported, additional connection string parameters are supported:
| Repository: | https://github.com/lib/pq |
| Homepage: | https://github.com/lib/pq |
| Latest Release: |
v1.10.9
about 3 years ago |
| Dependent Repos: | 81,738 |
| Dependent Packages: | 27,676 |
| Ranking: | Top 0.0149% by dependent repos Top 0.006% by dependent pkgs |