Describe the Bug
If the search_path is empty, CURRENT_SCHEMA() returns NULL but the reader tries to read a string so it fails with:
*database.Error: sql: Scan error on column index 0, name "current_schema": converting NULL to string is unsupported in line 0: SELECT CURRENT_SCHEMA()
Steps to Reproduce
Steps to reproduce the behavior:
- Give it a DSN with empty search path
- Run migrate
- It will fail badly
Expected Behavior
Fail better returning ErrNoSchema, in
Migrate Version
v4.15.0
Loaded Database Drivers
postgres
Go Version
go version go1.17.2 darwin/arm64
Additional context
Should just scan into *string allowing nulls to work.
cq=# set search_path='';
SET
cq=# SELECT CURRENT_SCHEMA();
current_schema
----------------
(1 row)
cq=# SELECT CURRENT_SCHEMA() is null;
?column?
----------
t
(1 row)