mirror of https://github.com/jackc/pgx.git
Skip JSON tests for old PostgreSQL servers
parent
e1215d9b19
commit
09e0cc4815
|
@ -440,6 +440,10 @@ func TestConnQueryJSONIntoByteSlice(t *testing.T) {
|
||||||
db := openDB(t)
|
db := openDB(t)
|
||||||
defer closeDB(t, db)
|
defer closeDB(t, db)
|
||||||
|
|
||||||
|
if !serverHasJSON(t, db) {
|
||||||
|
t.Skip("Skipping due to server's lack of JSON type")
|
||||||
|
}
|
||||||
|
|
||||||
_, err := db.Exec(`
|
_, err := db.Exec(`
|
||||||
create temporary table docs(
|
create temporary table docs(
|
||||||
body json not null
|
body json not null
|
||||||
|
@ -476,6 +480,10 @@ func TestConnExecInsertByteSliceIntoJSON(t *testing.T) {
|
||||||
db := openDB(t)
|
db := openDB(t)
|
||||||
defer closeDB(t, db)
|
defer closeDB(t, db)
|
||||||
|
|
||||||
|
if !serverHasJSON(t, db) {
|
||||||
|
t.Skip("Skipping due to server's lack of JSON type")
|
||||||
|
}
|
||||||
|
|
||||||
_, err := db.Exec(`
|
_, err := db.Exec(`
|
||||||
create temporary table docs(
|
create temporary table docs(
|
||||||
body json not null
|
body json not null
|
||||||
|
@ -510,6 +518,15 @@ func TestConnExecInsertByteSliceIntoJSON(t *testing.T) {
|
||||||
ensureConnValid(t, db)
|
ensureConnValid(t, db)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func serverHasJSON(t *testing.T, db *sql.DB) bool {
|
||||||
|
var hasJSON bool
|
||||||
|
err := db.QueryRow(`select true from pg_type where typname='json'`).Scan(&hasJSON)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("db.QueryRow unexpectedly failed: %v", err)
|
||||||
|
}
|
||||||
|
return hasJSON
|
||||||
|
}
|
||||||
|
|
||||||
func TestTransactionLifeCycle(t *testing.T) {
|
func TestTransactionLifeCycle(t *testing.T) {
|
||||||
db := openDB(t)
|
db := openDB(t)
|
||||||
defer closeDB(t, db)
|
defer closeDB(t, db)
|
||||||
|
|
Loading…
Reference in New Issue