- `github.com/lib/pq` PostgreSQL 드라이버 vendor 디렉토리에 추가. - PostgreSQL 관련 내부 패키지(`pqsql`, `proto`, `pqtime`, `pgpass`, `pgservice`, `pqutil`) 구현: - SQL 어휘 처리, 프로토콜 상수 및 구조 정의, 시간 파서/포맷터(`Parse`, `Format`). - `.pgpass` 파일 및 `pg_service.conf` 관리 기능 추가. - 파일/사용자 권한 검증 및 플랫폼별 사용자 정보 조회 기능 포함. - 데이터베이스 초기화 로직 추가 (`services/db.go`): - PostgreSQL 연결 설정 및 초기 스키마 생성. - 자동매매 관련 DB 레포지토리(`services/autotrade_repo.go`) 구현: - 자동매매 규칙 및 포지션 관리 로직 추가 (`dbInsertRule`, `dbLoadRules` 등).
9.1 KiB
unreleased
v1.12.3 (2026-04-03)
- Send datestyle startup parameter, improving compatbility with database engines that use a different default datestyle such as EnterpriseDB (#1312).
v1.12.2 (2026-04-02)
- Treat io.ErrUnexpectedEOF as driver.ErrBadConn so database/sql discards the connection. Since v1.12.0 this could result in permanently broken connections, especially with CockroachDB which frequently sends partial messages (#1299).
v1.12.1 (2026-03-30)
-
Look for pgpass file in ~/.pgpass instead of ~/.postgresql/pgpass (#1300).
-
Don't clear password if directly set on pq.Config (#1302).
v1.12.0 (2026-03-18)
-
The next release may change the default sslmode from
requiretoprefer. See #1271 for details. -
CopyIn()andCopyInToSchema()have been marked as deprecated. These are simple query builders and not needed forCOPY [..] FROM STDINsupport (which is not deprecated). (#1279)// Old tx.Prepare(CopyIn("temp", "num", "text", "blob", "nothing")) // Replacement tx.Prepare(`copy temp (num, text, blob, nothing) from stdin`)
Features
-
Support protocol 3.2, and the
min_protocol_versionandmax_protocol_versionDSN parameters (#1258). -
Support
sslmode=preferandsslmode=allow(#1270). -
Support
ssl_min_protocol_versionandssl_max_protocol_version(#1277). -
Support connection service file to load connection details (#1285).
-
Support
sslrootcert=systemand use~/.postgresql/root.crtas the default value of sslrootcert (#1280, #1281). -
Add a new
pqerrorpackage with PostgreSQL error codes (#1275).For example, to test if an error is a UNIQUE constraint violation:
if pqErr, ok := errors.AsType[*pq.Error](err); ok && pqErr.Code == pqerror.UniqueViolation { log.Fatalf("email %q already exsts", email) }To make this a bit more convenient, it also adds a
pq.As()function:pqErr := pq.As(err, pqerror.UniqueViolation) if pqErr != nil { log.Fatalf("email %q already exsts", email) }
Fixes
-
Fix SSL key permission check to allow modes stricter than 0600/0640#1265 (#1265).
-
Fix Hstore to work with binary parameters (#1278).
-
Clearer error when starting a new query while pq is still processing another query (#1272).
-
Send intermediate CAs with client certificates, so they can be signed by an intermediate CA (#1267).
-
Use
time.UTCfor UTC aliases such asEtc/UTC(#1282).
v1.11.2 (2026-02-10)
This fixes two regressions:
-
Don't send startup parameters if there is no value, improving compatibility with Supavisor (#1260).
-
Don't send
dbnameas a startup parameter ifdatabase=[..]is used in the connection string. It's recommended to use dbname=, as database= is not a libpq option, and only worked by accident previously. (#1261)
v1.11.1 (2026-01-29)
This fixes two regressions present in the v1.11.0 release:
-
Fix build on 32bit systems, Windows, and Plan 9 (#1253).
-
Named []byte types and pointers to []byte (e.g.
*[]byte,json.RawMessage) would be treated as an array instead of bytea (#1252).
v1.11.0 (2026-01-28)
This version of pq requires Go 1.21 or newer.
pq now supports only maintained PostgreSQL releases, which is PostgreSQL 14 and newer. Previously PostgreSQL 8.4 and newer were supported.
Features
-
The
pq.Error.Error()text includes the position of the error (if reported by PostgreSQL) and SQLSTATE code (#1219, #1224):pq: column "columndoesntexist" does not exist at column 8 (42703) pq: syntax error at or near ")" at position 2:71 (42601) -
The
pq.Error.ErrorWithDetail()method prints a more detailed multiline message, with the Detail, Hint, and error position (if any) (#1219):ERROR: syntax error at or near ")" (42601) CONTEXT: line 12, column 1: 10 | name varchar, 11 | version varchar, 12 | ); ^ -
Add
Config,NewConfig(), andNewConnectorConfig()to supply connection details in a more structured way (#1240). -
Support
hostaddrand$PGHOSTADDR(#1243). -
Support multiple values in
host,port, andhostaddr, which are each tried in order, or randomly ifload_balance_hosts=randomis set (#1246). -
Support
target_session_attrsconnection parameter (#1246). -
Support
sslnegotiationto use SSL without negotiation (#1180). -
Allow using a custom
tls.Config, for example for encrypted keys (#1228). -
Add
PQGO_DEBUG=1print the communication with PostgreSQL to stderr, to aid in debugging, testing, and bug reports (#1223).
Fixes
-
Match HOME directory lookup logic with libpq: prefer $HOME over /etc/passwd, ignore ENOTDIR errors, and use APPDATA on Windows (#1214).
-
Fix
sslmode=verify-caverifying the hostname anyway when connecting to a DNS name (rather than IP) (#1226). -
Correctly detect pre-protocol errors such as the server not being able to fork or running out of memory (#1248).
-
Fix build with wasm (#1184), appengine (#745), and Plan 9 (#1133).
-
Deprecate and type alias
pq.NullTimetosql.NullTime(#1211). -
Enforce integer limits of the Postgres wire protocol (#1161).
-
Accept the
passfileconnection parameter to overridePGPASSFILE(#1129). -
Fix connecting to socket on Windows systems (#1179).
-
Don't perform a permission check on the .pgpass file on Windows (#595).
-
Warn about incorrect .pgpass permissions (#595).
-
Don't set extra_float_digits (#1212).
-
Decode bpchar into a string (#949).
-
Fix panic in Ping() by not requiring CommandComplete or EmptyQueryResponse in simpleQuery() (#1234)
-
Recognize bit/varbit (#743) and float types (#1166) in ColumnTypeScanType().
-
Accept
PGGSSLIBandPGKRBSRVNAMEenvironment variables (#1143). -
Handle ErrorResponse in readReadyForQuery and return proper error (#1136).
-
Detect COPY even if the query starts with whitespace or comments (#1198).
-
CopyIn() and CopyInSchema() now work if the list of columns is empty, in which case it will copy all columns (#1239).
-
Treat nil []byte in query parameters as nil/NULL rather than
""(#838). -
Accept multiple authentication methods before checking AuthOk, which improves compatibility with PgPool-II (#1188).
v1.10.9 (2023-04-26)
-
Fixes backwards incompat bug with 1.13.
-
Fixes pgpass issue