I am migrating from PostgreSQL v15 to v16. During migration I got this error:
<code>GRANT
ERROR: function unaccent(text) does not exist
LINE 2: SELECT unaccent(coalesce($1, ''));
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:
SELECT unaccent(coalesce($1, ''));
CONTEXT: SQL function "str_norm" during inlining
ERROR: relation "banners_text_search" does not exist
LINE 1: SELECT text from banners_text_search
^
QUERY: SELECT text from banners_text_search
REFRESH MATERIALIZED VIEW
</code>
<code>GRANT
ERROR: function unaccent(text) does not exist
LINE 2: SELECT unaccent(coalesce($1, ''));
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:
SELECT unaccent(coalesce($1, ''));
CONTEXT: SQL function "str_norm" during inlining
ERROR: relation "banners_text_search" does not exist
LINE 1: SELECT text from banners_text_search
^
QUERY: SELECT text from banners_text_search
REFRESH MATERIALIZED VIEW
</code>
GRANT
ERROR: function unaccent(text) does not exist
LINE 2: SELECT unaccent(coalesce($1, ''));
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:
SELECT unaccent(coalesce($1, ''));
CONTEXT: SQL function "str_norm" during inlining
ERROR: relation "banners_text_search" does not exist
LINE 1: SELECT text from banners_text_search
^
QUERY: SELECT text from banners_text_search
REFRESH MATERIALIZED VIEW
But If I add connection to my database, then migration done successfully:
<code>GRANT
You are now connected to database "mydb" as user "postgres".
REFRESH MATERIALIZED VIEW
</code>
<code>GRANT
You are now connected to database "mydb" as user "postgres".
REFRESH MATERIALIZED VIEW
</code>
GRANT
You are now connected to database "mydb" as user "postgres".
REFRESH MATERIALIZED VIEW
The command I used:
<code>docker exec -it postgres bash -c 'pg_dumpall --clean --if-exists -U postgres |
sed "/^REFRESH MATERIALIZED VIEW public.banners_text_search;/ i \\\connect mydb" |
psql postgresql://[email protected]'
</code>
<code>docker exec -it postgres bash -c 'pg_dumpall --clean --if-exists -U postgres |
sed "/^REFRESH MATERIALIZED VIEW public.banners_text_search;/ i \\\connect mydb" |
psql postgresql://[email protected]'
</code>
docker exec -it postgres bash -c 'pg_dumpall --clean --if-exists -U postgres |
sed "/^REFRESH MATERIALIZED VIEW public.banners_text_search;/ i \\\connect mydb" |
psql postgresql://[email protected]'
Why this error occured?
Why pg_dumpall
does not create connect mydb
automatically?
15