-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no results returned with postgres when using json flag v0.38 ??? #261
Comments
@c-nv-s Thanks for the quick report.
|
|
|
@c-nv-s thanks, will look into it now. A few more questions:
|
|
@c-nv-s It seems to be working for me on a debian buster container, on a fresh install. Looking at your log file, I see this: {"time":"2023-06-18T18:33:29.487199194Z","level":"DEBUG","source":"cli/cli.go:81","msg":"EXECUTE","pid":18032,"args":".authorizer_users ) -j"}
Note the Can you show me the exact output of executing this: $ sq 1 --json For me I see (on debian buster): $ sq 1 --json
[
{
"1": 1
}
] |
that's odd.
|
Weird. What’s the output of |
yes that work... haha... how weird |
Does it happen with any other table name? |
yes all other tables names also hang with just the
yet works with |
also curious why this didn't throw an error |
How bizarre. Let's try to eliminate variables. Could you do the following: # Move your config folder to a temporary location (so you
# start with a fresh config)
$ sq config location
/root/.config/sq
$ mv /root/.config/sq /root/.config/sq_bak
# Download and add the sqlite sakila database file
$ wget https://sq.io/testdata/sakila.db
$ sq add ./sakila.db
# Test JSON output
$ sq .actor --json |
The parser tries to be forgiving, but maybe it's too forgiving... I need to figure out what's happening in that scenario. I'd like for that to return an error. |
works perfectly |
I then tried:
hangs indefinitely.... |
To verify that we're doing the same thing: $ docker run -d -p 5432:5432 sakiladb/postgres:12
$ sq add postgres://sakila:p_ssW0rd@localhost/sakila --handle @sakila_pg12
$ sq src @sakila_pg12
$ sq .actor --json |
Also, for the problematic database, can you show the top part of the output for $ sq inspect @sakila_pg12 --json
{
"handle": "@sakila_pg12",
"location": "postgres://sakila:xxxxx@localhost/sakila",
"name": "sakila",
"name_fq": "sakila.public",
"schema": "public",
"driver": "postgres",
"db_driver": "postgres",
"db_product": "PostgreSQL 12.13 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit",
"db_version": "12.13", |
this is for my original instance, I'll setup the sakiladb/postgres and also try
|
|
Yes:
|
A couple more questions:
|
I just tested with pg15, no problems. Weirder and weirder. |
yeah also just tested with |
This issue is very befuddling. The output writer mechanism (json vs yaml vs text) is independent of the DB query mechanism. Can you try something else for me? Please try the query for each and every output format (csv, markdown etc). I want to see if it’s ONLY the json format. |
ok give me a moment |
it is just the |
|
hashes for fake passwords redacted but should give you an idea... I'm completely baffled
|
I was thinking perhaps there might be an issue rendering valid json with the password field, but then if that was the case the |
Thanks, I was about to ask! I’ll see if I can replicate the issue locally. |
@c-nv-s I took a look at that authorizer repo... I might be blind, but where can I find the Postgres container? In the Makefile, I see: test-all-db:
rm -rf server/test/test.db server/test/test.db-shm server/test/test.db-wal && rm -rf test.db test.db-shm test.db-wal
docker run -d --name authorizer_scylla_db -p 9042:9042 scylladb/scylla
docker run -d --name authorizer_mongodb_db -p 27017:27017 mongo:4.4.15
docker run -d --name authorizer_arangodb -p 8529:8529 -e ARANGO_NO_AUTH=1 arangodb/arangodb:3.10.3
docker run -d --name dynamodb-local-test -p 8000:8000 amazon/dynamodb-local:latest
docker run -d --name couchbase-local-test -p 8091-8097:8091-8097 -p 11210:11210 -p 11207:11207 -p 18091-18095:18091-18095 -p 18096:18096 -p 18097:18097 couchbase:latest
sh scripts/couchbase-test.sh How are you creating the Postgres container? |
@c-nv-s NM, figured it out. I can confirm I'm seeing the same issue. Now to track this down. |
… Flush() call (#262) * jsonw: deadlock occurred when record was large, due to mutex on Flush() call
@c-nv-s: I've pushed a new release: can you try this again with |
ok let me check |
yes that seems to have fixed it :-) |
Thanks Neil I'm happy to close this.
|
@c-nv-s Glad that resolved it. The old adage premature optimization is the root of all evil strikes again 🤦 |
Describe the bug
version 0.38.0 using json flag hangs/crashes the tool???
OS: debian
release: 0.38.0 release binary
data source: postgres 15
works:
sq '.users'
- results displayedfails:
sq '.users' --json
- no results just hangs indefinitelyfails:
sq -j '.users'
- no results just hangs indefinitelyThe text was updated successfully, but these errors were encountered: