You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: postgresql.go
    path of file: ./repos/langchaingo/tools/sqldatabase/postgresql
    
    the code of the file until where you have to start completion: package postgresql

import (
	"context"
	"database/sql"

	_ "github.com/jackc/pgx/v5/stdlib" // postgresql driver
	"github.com/tmc/langchaingo/tools/sqldatabase"
)

const EngineName = "pgx"

// init registers the PostgreSQL engine with the sqldatabase package.
// It is automatically called during package initialization.
//
//nolint:gochecknoinits
func init() {
	sqldatabase.RegisterEngine(EngineName, NewPostgreSQL)
}

var _ sqldatabase.Engine = PostgreSQL{}

// PostgreSQL represents the PostgreSQL engine.
type PostgreSQL struct {
	db *sql.DB
}

// NewPostgreSQL creates a new PostgreSQL engine instance.
// The dsn parameter is the data source name
// (e.g. postg
    
func (p PostgreSQL) Query(ctx context.Context, query string, args ...any) ([]string, [][]string, error) {
	rows, err := p.db.QueryContext(ctx, query, args...)
	if err != nil {
		return nil, nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, nil, err
	}
	defer rows.Close()
	cols, err := rows.Columns()
	if err != nil {
		return nil, nil, err
	}
	results := make([][]string, 0)
	for rows.Next() {
		row := make([]string, len(cols))
		rowNullable := make([]sql.NullString, len(cols))
		rowPtrs := make([]interface{}, len(cols))
		for i := range row {
			rowPtrs[i] = &rowNullable[i]
		}
		err = rows.Scan(rowPtrs...)
		if err != nil {
			return nil, nil, err
		}
		for i := range rowNullable {
			row[i] = rowNullable[i].String
		}
		results = append(results, row)
	}
	return cols, results, nil
}