top
(README.md)
# pq - A pure Go postgres driver for Go's database/sql package

**This package is now deprecated. The up to date version is at
[github.com/lib/pq](https://github.com/lib/pq).**

## Install

	go get github.com/bmizerany/pq

## Docs

<http://go.pkgdoc.org/github.com/bmizerany/pq>

## Use

	package main

	import (
		_ "github.com/bmizerany/pq"
		"database/sql"
	)

	func main() {
		db, err := sql.Open("postgres", "user=pqgotest dbname=pqgotest sslmode=verify-full")
		// ...
	}

**Connection String Parameters**

These are a subset of the libpq connection parameters.  In addition, a
number of the [environment
variables](http://www.postgresql.org/docs/9.1/static/libpq-envars.html)
supported by libpq are also supported.  Just like libpq, these have
lower precedence than explicitly provided connection parameters.

See http://www.postgresql.org/docs/9.1/static/libpq-connect.html.

* `dbname` - The name of the database to connect to
* `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`)
* `sslmode` - Whether or not to use SSL (default is `require`, this is not the default for libpq)
	Valid values are:
	* `disable` - No SSL
	* `require` - Always SSL (skip verification)
	* `verify-full` - Always SSL (require verification)

See http://golang.org/pkg/database/sql to learn how to use with `pq` through the `database/sql` package.

## Tests

`go test` is used for testing.  A running PostgreSQL server is
required, with the ability to log in.  The default database to connect
to test with is "pqgotest," but it can be overridden using environment
variables.

Example:

	PGHOST=/var/run/postgresql go test pq

## Features

* SSL
* Handles bad connections for `database/sql`
* Scan `time.Time` correctly (i.e. `timestamp[tz]`, `time[tz]`, `date`)
* Scan binary blobs correctly (i.e. `bytea`)
* pq.ParseURL for converting urls to connection strings for sql.Open.
* Many libpq compatible environment variables
* Unix socket support

## Future / Things you can help with

* Notifications: `LISTEN`/`NOTIFY`
* `hstore` sugar (i.e. handling hstore in `rows.Scan`)

## Thank you (alphabetical)

Some of these contributors are from the original library `bmizerany/pq.go` whose
code still exists in here.

* Andy Balholm (andybalholm)
* Ben Berkert (benburkert)
* Bjørn Madsen (aeons)
* Blake Gentry (bgentry)
* Brad Fitzpatrick (bradfitz)
* Daniel Farina (fdr)
* Everyone at The Go Team
* Federico Romero (federomero)
* Heroku (heroku)
* John Gallagher (jgallagher)
* Kamil Kisiel (kisielk)
* Keith Rarick (kr)
* Marc Brinkmann (mbr)
* Martin Olsen (martinolsen)
* Mike Lewis (mikelikespie)
* Ryan Smith (ryandotsmith)
* Samuel Stauffer (samuel)
* notedit (notedit)

Imported by 279 package(s)

  1. bitbucket.org/jaybill/sawsij/framework
  2. bitbucket.org/ongisnotaguild/obi-wan-kanbanobi/kanban
  3. github.com/3d0c/hood
  4. github.com/3fps/shawty/data
  5. github.com/3zcurdia/gotiny
  6. github.com/AndreMouche/beedb/example
  7. github.com/ArtemTeleshev/beedb/example
  8. github.com/BrandonY/gobyexample/examples/postgres
  9. github.com/Claymore/search-kladr
  10. github.com/CreaturePhil/gobyexample/examples/postgres
  11. github.com/DeyV/go-pgtest/hellosql
  12. github.com/FernandoEscher/golang-geo
  13. github.com/FreeFlightSim/golang-geo
  14. github.com/IMQS/sente
  15. github.com/JessonChan/beedb/example
  16. github.com/Khady/obiwan-kanbanobi/kanban
  17. github.com/MajorMJR/homesite
  18. github.com/MajorMJR/pingo
  19. github.com/MajorMJR/pingo/server
  20. github.com/MobiSolutions/beedb/example
  21. github.com/Murugan78/beedb/example
  22. github.com/Mustwin/monitoring/app/models
  23. github.com/Neeke/beedb/example
  24. github.com/NoahShen/beedb/example
  25. github.com/Noxer/GoPostgreSQL
  26. github.com/OllyGinger/ImgurGallery
  27. github.com/RaymondChou/beedb/example
  28. github.com/Sas0ri/beedb/example
  29. github.com/SohoStudio/beedb/example
  30. github.com/SophisticaSean/meme_coin
  31. github.com/SophisticaSean/meme_coin/handlers
  32. github.com/StefanKjartansson/hood
  33. github.com/SunLnx/goblog/model
  34. github.com/TheOnly92/morioka/infrastructure
  35. github.com/YouthBuild-USA/godata
  36. github.com/ZachBergh/beedb/example
  37. github.com/aaronlifton/Gooo/model
  38. github.com/aaronlifton/gooo/model
  39. github.com/aidenliu/webanalytics
  40. github.com/anastasop/oneshot
  41. github.com/aquilax/novigeroi-go
  42. github.com/areski/beedb/example
  43. github.com/areski/cgrates/engine
  44. github.com/astaxie/beedb/example
  45. github.com/ateleshev/beedb/example
  46. github.com/avidal/chihaya/storage/batter
  47. github.com/aybabtme/goblog/model
  48. github.com/bbezuk/upnode
  49. github.com/bboyxu/gobyexample/examples/postgres
  50. github.com/bgentry/gls
  51. github.com/bgentry/hk/hkdist
  52. github.com/bgentry/l2met/librato_outlet
  53. github.com/bgentry/l2met/token
  54. github.com/bittersweet/gobyexample/examples/postgres
  55. github.com/blachniet/gobyexample/examples/postgres
  56. github.com/boostbob/beedb/example
  57. github.com/bortzmeyer/GoRTR
  58. github.com/brandur/blackswan-go
  59. github.com/brandur/umbrella
  60. github.com/brettbuddin/gorp
  61. github.com/c0gent/auctionLog
  62. github.com/c0gent/halloween
  63. github.com/c0gent/halloween/bak
  64. github.com/cartwright/kitchenSink/sinkDb
  65. github.com/clooth/cares
  66. github.com/collinvandyck/go-and-java/go
  67. github.com/coocood/hood
  68. github.com/coreywang/hood
  69. github.com/coyotey/gobyexample/examples/postgres
  70. github.com/custa/gobyexample/examples/postgres
  71. github.com/cwc/asset-tracker
  72. github.com/cwc/asset-tracker/models
  73. github.com/dandavison/gobyexample/examples/postgres
  74. github.com/daneharrigan/hk/hkdist
  75. github.com/davidglivar/bookmarked
  76. github.com/davidglivar/datum/src/db
  77. github.com/davidglivar/datum/src/model
  78. github.com/davsk/eve/analysis
  79. github.com/dcosson/beedb/example
  80. github.com/deepfryed/go-vs-swift
  81. github.com/devonestes/gobyexample/examples/postgres
  82. github.com/divan/gobyexample/examples/postgres
  83. github.com/divoxx/hood
  84. github.com/dlintw/gobyexample/examples/postgres
  85. github.com/dongaihua/beedb/example
  86. github.com/doun/beedb/example
  87. github.com/doun/hood
  88. github.com/dpiddy/go-pq-test
  89. github.com/dpiddy/hk/hkdist
  90. github.com/dpritchett/hk/hkdist
  91. github.com/drbawb/chihaya/storage/batter
  92. github.com/earlbalai/shorty
  93. github.com/earlbalai/thebus
  94. github.com/easonchou/beedb/example
  95. github.com/elvin-du/beedb/example
  96. github.com/erikh/g211-web-go
  97. github.com/erikh/g211-web-go/get-loud
  98. github.com/erikh/g211-web-go/import
  99. github.com/everyx/gobyexample/examples/postgres
  100. github.com/fabiokung/gls
  101. github.com/fanatic/hk/hkdist
  102. github.com/fanliao/beedb/example
  103. github.com/fdr/hk/hkdist
  104. github.com/financeCoding/gobyexample/examples/postgres
  105. github.com/firebitsbr/gobyexample/examples/postgres
  106. github.com/flynn-archive/flynn-cli-dist
  107. github.com/freeflightsim/golang-geo
  108. github.com/funnylookinhat/gobyexample/examples/postgres
  109. github.com/gabstv/beedb/example
  110. github.com/gamache/hood
  111. github.com/georgyo/beedb/example
  112. github.com/glycerine/beedb/example
  113. github.com/gokyle/golobsters/dbase
  114. github.com/gokyle/rsstotwitter/dbase
  115. github.com/golibs/um/pg
  116. github.com/gqf2008/beedb/example
  117. github.com/hardPass/beedb/example
  118. github.com/hefju/GoFirst
  119. github.com/heidsoft/beedb/example
  120. github.com/helmi03/golang-stuff/github.com/astaxie/beedb/example
  121. github.com/helmi03/golang-stuff/github.com/mmcgrana/gobyexample/examples/postgres
  122. github.com/hobbs/beedb/example
  123. github.com/huyan/beedb/example
  124. github.com/hydrogen2005/analytics.go
  125. github.com/hypermusk/todoapp/server
  126. github.com/icasimpan/gobyexample/examples/postgres
  127. github.com/imdario/gotli
  128. github.com/inconshreveable/hk/hkdist
  129. github.com/ismasan/datagram.io/db
  130. github.com/jameswei/beedb/example
  131. github.com/janne/gometrics
  132. github.com/jasonrdsouza/foosball_monkey/datastore
  133. github.com/jaybill/sawsij/framework
  134. github.com/jaywgraves/gobyexample/examples/postgres
  135. github.com/jeffadams78/address-autocomplete
  136. github.com/jingweno/hk/hkdist
  137. github.com/jlhonora/honorato.org/playground
  138. github.com/jlouis/rank
  139. github.com/jonesdeini/sandvich_webcrawler
  140. github.com/jonsen/beedb/example
  141. github.com/jonsen/gobyexample/examples/postgres
  142. github.com/jspaulding/hood
  143. github.com/justinbarry/hood
  144. github.com/kashdan/gobyexample/examples/postgres
  145. github.com/kbajey/gobyexample/examples/postgres
  146. github.com/kekek/gobyexample/examples/postgres
  147. github.com/kmagoye/go/goByExample/examples/postgres
  148. github.com/kr/hk/hkdist
  149. github.com/kristofer/Gooo/model
  150. github.com/kulasama/beedb/example
  151. github.com/layeka/beedb/example
  152. github.com/lbolla/hood
  153. github.com/leverly/gobyexample/examples/postgres
  154. github.com/linphy/beedb/example
  155. github.com/linuxmaniac/pkg-cgrates/engine
  156. github.com/liudch/beedb/example
  157. github.com/liusongsen/beedb/example
  158. github.com/liuzhe0223/beedb/example
  159. github.com/lukegb/hood
  160. github.com/magastzheng/beedb/example
  161. github.com/makhov/gobyexample/examples/postgres
  162. github.com/maratart/gobyexample/examples/postgres
  163. github.com/markpasc/cares
  164. github.com/martinhansdk/beedb/example
  165. github.com/maxpolun/go-weightlog/util
  166. github.com/mblair/go-by-example/src
  167. github.com/michaelboke/beedb/example
  168. github.com/mikejihbe/beedb/example
  169. github.com/milliyang/golang-stuff/github.com/astaxie/beedb/example
  170. github.com/milliyang/golang-stuff/github.com/mmcgrana/gobyexample/examples/postgres
  171. github.com/millken/cgrates/engine
  172. github.com/mkopta/nephos/src
  173. github.com/mmcfarland/address-autocomplete
  174. github.com/mmcfarland/go-tiler
  175. github.com/mmcfarland/plk
  176. github.com/mmcfarland/prc
  177. github.com/mmcgrana/gobyexample/examples/postgres
  178. github.com/mroote/homesite
  179. github.com/mroote/pingo
  180. github.com/mroote/pingo/server
  181. github.com/msgbox/storage
  182. github.com/msp8955/bismark-passive-server-go/passive
  183. github.com/mtabini/golang-geo
  184. github.com/muroachanf/beedb/example
  185. github.com/murz/ego/db
  186. github.com/naaman/hk/hkdist
  187. github.com/nagae-memooff/beedb/example
  188. github.com/nanjishidu/beedb/example
  189. github.com/natemontgomery/rvrn
  190. github.com/nateriver520/beedb/example
  191. github.com/natmeox/mess
  192. github.com/natmeox/mess/cmd
  193. github.com/nemowen/golang/postgresql
  194. github.com/nexneo/beedb/example
  195. github.com/nikai3d/gobyexample/examples/postgres
  196. github.com/nilslice/um/pg
  197. github.com/nobu-k/beedb/example
  198. github.com/nordicdyno/shawty/data
  199. github.com/notedit/eightfoot/backend/src/server
  200. github.com/noxer/GoPostgreSQL
  201. github.com/nsan1129/auctionLog
  202. github.com/ohlinux/golang-snippet-cn/gobyexample/examples/postgres
  203. github.com/oldtree/beedb/example
  204. github.com/pankajghosh/flickfind-discard
  205. github.com/patamushta/gobyexample/examples/postgres
  206. github.com/patrick-higgins/go-and-java/go
  207. github.com/patrickToca/bootic_data_collector/db
  208. github.com/pearkes/hood
  209. github.com/pearkes/up-server
  210. github.com/phacops/hood
  211. github.com/pilu/cerebellum
  212. github.com/pilu/microphone
  213. github.com/prinsmike/hood
  214. github.com/pvh/femebe/tools
  215. github.com/qbit/woody
  216. github.com/qwertmax/interview_tasks
  217. github.com/qwertmax/quiz-go/db
  218. github.com/qwertmax/timeconverter/db
  219. github.com/rdscorreia/gobyexample/examples/postgres
  220. github.com/redneckbeard/hood
  221. github.com/remigijusj/beedb/example
  222. github.com/rhencke/mess
  223. github.com/rhencke/mess/cmd
  224. github.com/rif/gocmd/postgres
  225. github.com/robertojrojas/gobyexample/examples/postgres
  226. github.com/robfig/modsql/test
  227. github.com/robyoung/beedb/example
  228. github.com/roessland/gobyexample/examples/postgres
  229. github.com/romanoff/beedb/example
  230. github.com/ryandotsmith/boc
  231. github.com/ryandotsmith/komrade/store
  232. github.com/ryandotsmith/m2pg
  233. github.com/ryandotsmith/wcld
  234. github.com/sburnett/bismark-passive-server-go/passive
  235. github.com/sburnett/bismark-tools/availability-intervals
  236. github.com/sburnett/bismark-tools/bdmq/commands
  237. github.com/sburnett/bismark-tools/bdmq/datastore
  238. github.com/scottcagno/Gooo/model
  239. github.com/scottcagno/beedb/example
  240. github.com/sdming/kdb/example
  241. github.com/shadowmint/go-fluent
  242. github.com/sjltaylor/datagram.io/db
  243. github.com/sjp38/AndnyangWeb
  244. github.com/sluu99/shawty/data
  245. github.com/sluu99/um/pg
  246. github.com/snluu/shawty/data
  247. github.com/snluu/um/pg
  248. github.com/snyderep/genreco/go/src/github.com/snyderep/recogen/database
  249. github.com/softlns/beedb/example
  250. github.com/songofhack/beedb/example
  251. github.com/soulinfo/kdb/example
  252. github.com/spiffytech/bible_fixer
  253. github.com/spyrexd/bank_failure/process_bank_info
  254. github.com/stehem/plenty_of_links
  255. github.com/stormdock/gobyexample/examples/postgres
  256. github.com/svalleru/gobyexample/examples/postgres
  257. github.com/szabba/gobyexample/examples/postgres
  258. github.com/tenmozes/gobyexample/examples/postgres
  259. github.com/the-obsidian/mc/mcdist
  260. github.com/thetwentyone/beedb/example
  261. github.com/timdufrane/hood
  262. github.com/tonyjt/beedb/example
  263. github.com/trygo/beedb/example
  264. github.com/ttllpp/beedb/example
  265. github.com/uhoh-itsmaciek/gobyexample/examples/postgres
  266. github.com/ulugbekrozimboyev/gobyexample/examples/postgres
  267. github.com/uriel/hk/hkdist
  268. github.com/viniciusfeitosa/gobyexample/examples/postgres
  269. github.com/w4g3n3r/gopg
  270. github.com/wikiocracy/voteflow
  271. github.com/will/gobyexample/examples/postgres
  272. github.com/wujiang/goe/bqe
  273. github.com/xiocode/jet/example
  274. github.com/xuxiao/beedb/example
  275. github.com/yml/botbot-bot
  276. github.com/z8/mind
  277. github.com/z8/mind/utility
  278. github.com/zhaming/beedb/example
  279. simplex.sh/store

Imported only in test by 27 package(s)

  1. bitbucket.org/jaybill/sawsij/framework/model
  2. github.com/DDRBoxman/crud
  3. github.com/DeyV/gorp
  4. github.com/NoahShen/gorp
  5. github.com/SohoStudio/beego/orm
  6. github.com/ZhuBicen/beego/orm
  7. github.com/adamflott/gorp
  8. github.com/cgyy/jet
  9. github.com/ddrboxman/crud
  10. github.com/doun/gorp
  11. github.com/dworld/gorp
  12. github.com/fvbock/gorp
  13. github.com/hpgood/gorp
  14. github.com/ideamean/beego/orm
  15. github.com/jaybill/sawsij/framework/model
  16. github.com/lemmi/gorp
  17. github.com/modcloth/gorp
  18. github.com/nexneo/gorp
  19. github.com/notedit/eightfoot/backend/src/service/content
  20. github.com/notedit/eightfoot/backend/src/service/tag
  21. github.com/notedit/eightfoot/backend/src/service/user
  22. github.com/shin-/gorp
  23. github.com/shykes/gorp
  24. github.com/sjltaylor/respond/auth
  25. github.com/tjyang/beego/orm
  26. github.com/xiocode/jet
  27. github.com/xumingming/beego/orm