Closed aenawi closed 1 year ago
Does your database connection string contain a database name?
This is my connection string (dsn): postgresql://admin@localhost:26257?sslmode=disable
Yes; I think I'm missing something! This line hidden somewhere inside a config file, where I didn't check!
I guess adding the dbname comes after the port number, just like Postgres. So, it should be:
postgresql://admin@localhost:26257/mydb?sslmode=disable
I need to check this very soon.
Thanks for the hint.
Yes it worked! The answer was staring at me all the time, but I wasn't looking!
So, this is not considered a bug anymore.
Thanks a lot.
Describe the bug I'm using CockroachDB with Postgres driver
(pgx)
, I'm trying to do some CRUDs frommydb
with a different schema other thanpublic
(the default). The values provided through an API.The code:
The debug statement out of stmt.DebugSql() command looks like this:
I noticed that the database name
mydb
is not included with the generated code from the Jet CLI!When I tried to run the code to insert the data, I receive the following error from CockroachDB:
and to confirm that it's not my code that's causing this error, I ran the same statement from CockroachDB sql terminal, it displays the same error! But then I tried to solve the issue by adding the database name "mydb" prefix before the schema name and ran it again from CockroachDB Sql terminal, and it worked. Technically, if I'm in the same DB (USE mydb) then it should work without prefixing the db name, but it's a must if you're in other DBs:
The result:
NB: I tried to execute
USE mydb
sql statement from code usingExecContext()
, but that didn't help either!Environment (please complete the following information):
Expected behavior One or multiple of the following scenarios: