On 7/22/24 10:51 AM, Ertan Küçükoglu wrote:
> Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>>, 22 Tem 2024 Pzt, 20:37 tarihinde
> şunu yazdı:
>
> What is the command you use to restore the pg_dumpall file?
>
>
> within psql I run \i <dump_file_name>
>
> template1 should not be dropped in the pg_dumpall file.
>
> Is there output that shows that happening?
>
>
> --
> -- Databases
> --
>
> --
> -- Database "template1" dump
> --
>
> --
> -- PostgreSQL database dump
> --
>
> -- Dumped from database version 16.3
> -- Dumped by pg_dump version 16.3
>
> SET statement_timeout = 0;
> SET lock_timeout = 0;
> SET idle_in_transaction_session_timeout = 0;
> SET client_encoding = 'UTF8';
> SET standard_conforming_strings = on;
> SELECT pg_catalog.set_config('search_path', '', false);
> SET check_function_bodies = false;
> SET xmloption = content;
> SET client_min_messages = warning;
> SET row_security = off;
>
> UPDATE pg_catalog.pg_database SET datistemplate = false WHERE datname =
> 'template1';
> DROP DATABASE template1;
> --
> -- Name: template1; Type: DATABASE; Schema: -; Owner: postgres
> --
>
> CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UTF8'
> LOCALE_PROVIDER = libc LOCALE = 'Turkish_Turkey.1254';
>
> Above lines are taken from the dump file itself and it does indeed drop
> the template1. I think this is because this is a cluster dump.
It is because you specified -c to the pg_dumpall command. This cleans
the database you are restoring to by dropping the existing databases,
roles and tablespaces before restoring the objects in the file
I am getting out of my depth here, but I am pretty sure that:
ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'Turkish_Turkey.1254'
is not going to work. That you will need to change the locale to a
Turkish UTF8 name.
> Later it tries to create a new template1 and that command causes an
> error because of Windows locale name.
>
>
> Was template1 dropped in the Windows Postgres instance?
>
>
> No. It still is there.
>
> BTW dump is taken using the below command line on Windows system.
> "C:\Program Files\PostgreSQL\16\bin\pg_dumpall.exe" -U postgres -h
> 127.0.0.1 -p 5432 -c -f "c:\yedek\cluster.dump.sql"
>
> Thanks & Regards,
> Ertan
--
Adrian Klaver
adrian.klaver@aklaver.com