Skip to content
Discussion options

You must be logged in to vote

Works for me.

package main

import (
	"context"
	"log"
	"os"

	"github.com/jackc/pgx/v5"
)

func main() {
	ctx := context.Background()

	conn, err := pgx.Connect(ctx, os.Getenv("DATABASE_URL"))
	if err != nil {
		log.Fatal(err)
	}
	defer conn.Close(ctx)

	_, err = conn.Exec(ctx, "create temporary table t (id bigint primary key, ary int[][]);")
	if err != nil {
		log.Fatal(err)
	}

	_, err = conn.Exec(ctx, "insert into t values (1, $1);", [][]int{{1, 2}, {3, 4}})
	if err != nil {
		log.Fatal(err)
	}

	var ary [][]int
	err = conn.QueryRow(ctx, "select ary from t where id = 1;").Scan(&ary)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("ary: %v", ary)
}
jack@glados ~/dev/pgx_issues/pgx-22…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@pacifico3000
Comment options

@codercms
Comment options

@jackc
Comment options

jackc Nov 9, 2025
Maintainer

Answer selected by pacifico3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants