Re: Orphaned relations after crash/sigkill during CREATE TABLE
| От | Jason Myers |
|---|---|
| Тема | Re: Orphaned relations after crash/sigkill during CREATE TABLE |
| Дата | |
| Msg-id | CAFzLwcxDiNvffDLDRc2Mh3js+ub76QZLyAei6QWEr7Hv8p4O-A@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Orphaned relations after crash/sigkill during CREATE TABLE (Adrian Klaver <adrian.klaver@aklaver.com>) |
| Ответы |
Re: Orphaned relations after crash/sigkill during CREATE TABLE
|
| Список | pgsql-general |
> On Tue, Aug 18, 2020 at 3:49 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> Have you tried with:
> BEGIN;
> CREATE TABLE some_table SELECT some_data FROM other_table LIMIT 1 WITH
> NO DATA;
> COMMIT;
>
> The above gets you the table structure, but no data.
>
> BEGIN;
> INSERT into some_table SELECT * FROM other_table;
>COMMIT;
>
> The above populates the table
> CREATE TABLE some_table SELECT some_data FROM other_table LIMIT 1 WITH
> NO DATA;
> COMMIT;
>
> The above gets you the table structure, but no data.
>
> BEGIN;
> INSERT into some_table SELECT * FROM other_table;
>COMMIT;
>
> The above populates the table
Thanks -- we were indeed creating and populating the new table all in a single transaction.
I'll see if we can split this into two transactions so that the table structure is committed quickly. I think you're right that this would mostly sidestep the issue.
-Jason
p.s. Apologies if this is formatted wrong, this is my first mailing list post.
В списке pgsql-general по дате отправления: