pq Questions
2
Solved
Take a simple PostreSQL db with an integer array:
CREATE TABLE foo (
id serial PRIMARY KEY,
bar integer[]
);
INSERT INTO foo VALUES(DEFAULT, '{1234567, 20, 30, 40}');
Using pq, these values ...
4
Solved
In Go, I was trying simple database connection. I need to import gorilla/mux, but I couldn't.
I am using VS Code. After cd ing to my project directory, I created main.go and did run
go get -u git...
0
I want to scan in an array of strings using the pgx library without using pq ideally. Is there a way of doing this:
sourceKeys := make([]string, 0, 1)
err := rows.Scan(
pq.Array(&sourceKeys),
...
Ruthenic asked 1/4, 2022 at 0:1
1
Solved
I'd like to insert some binary data into a BYTEA column,
How would I go about streaming the contents of somefile.tar.gz into a table with a BYTEA column?
Is it possible to stream to/from postgres f...
Sneeze asked 15/3, 2019 at 21:8
2
Solved
I am trying to do csv import and export data with postgresql (where the data base is at a remote host). Normally I would use the psql command to do \copy <table> from <local path> ... a...
Alvera asked 9/8, 2021 at 6:30
2
I am running a query in Golang where I select multiple rows from my Postgresql Database.
I am using the following imports for my query
"database/sql"
"github.com/lib/pq"
I have narrowed down to...
Meprobamate asked 25/5, 2017 at 16:28
1
Solved
I am working with golang-postgres:
"database/sql"
_ "github.com/lib/pq"
What I am doing:
I run a select query.
If I don't get any entry on selecting, I go ahead and insert one.
Else, update, or...
Hulsey asked 27/11, 2018 at 20:39
1
Solved
Following code is working fine. But I want to define array['a', 'b', 'c', 'd', 'e'] as a variable.
rows, err := db.Query("select colname from (SELECT date, unnest(array['a', 'b', 'c', 'd', 'e']) ...
Kuomintang asked 6/10, 2018 at 11:1
1
Solved
How do you use a dynamic table name for a prepared INSERT statement for the pq postgres driver? At the moment I've got a test table with id SERIAL and values TEXT columns, and this statement is fai...
1
Solved
I use this driver to communicate with psql from Go. Now when I issue an update query, I have no possibility to know whether it actually updated anything (it can update 0 rows if such id is not pres...
1
Using postgres 9.3, go 1.6
I've been trying to use transactions with the go pq library.
// Good
txn, _ := db.Begin()
txn.Query("UPDATE t_name SET a = 1")
err := txn.Commit() // err is nil
// Bad...
Lucania asked 29/3, 2016 at 21:59
1
© 2022 - 2024 — McMap. All rights reserved.