Re: Diffrent column ordering after dump/restore tables with INHERITS

Поиск
Список
Период
Сортировка
От Oleg Serov
Тема Re: Diffrent column ordering after dump/restore tables with INHERITS
Дата
Msg-id cec7c6df0907050145jf06470cne179545381411bf7@mail.gmail.com
обсуждение исходный текст
Ответ на Diffrent column ordering after dump/restore tables with INHERITS  (Oleg Serov <serovov@gmail.com>)
Ответы Re: Diffrent column ordering after dump/restore tables with INHERITS  (Oleg Serov <serovov@gmail.com>)
Список pgsql-bugs
No, we can't do like this, because we have something like this:

CREATE TABLE test_base (
    id INT
);
CREATE TABLE test_child_with_data (
    t TEXT
) INHERITS (test_base);

ALTER TABLE test_base ADD COLUMN date DATE;

INSERT INTO test_child_with_data VALUES (1, 'text', NOW());

CREATE FUNCTION some_magic() RETURNS SETOF test_child_with_data AS
$$
    SELECT (SUM(id), t, MIN(date))::test_child_with_data
        FROM test_child_with_data
        GROUP BY t
$$ LANGUAGE SQL;


INSERT INTO test_child_with_data
    SELECT * FROM some_magic(); -- Works fine.


-- Dump/restore


INSERT INTO test_child_with_data
    SELECT * FROM some_magic(); -- Error.


On Sun, Jul 5, 2009 at 4:48 AM, toruvinn<toruvinn@lain.pl> wrote:
> On Sat, 04 Jul 2009 22:10:55 +0200, Oleg Serov <serovov@gmail.com> wrote:
>>
>> INSERT INTO test_child_with_data
>> =A0 =A0 =A0 =A0SELECT 1, 'test', NOW(); -- works fine.
>> -- Dump/restore
>> INSERT INTO test_child_with_data
>> =A0 =A0 =A0 =A0SELECT 1, 'test', NOW(); -- error..
>
> How about INSERT INTO test_child_with_data (id, t, date) SELECT 1, 'test',
> NOW(); ? You'll won't have to care about order of the columns anymore.
>
> Best regards,
> --
> ru
>

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Peter Headland"
Дата:
Сообщение: Re: BUG #4899: Open parenthesis breaks query plan
Следующее
От: Oleg Serov
Дата:
Сообщение: Re: Diffrent column ordering after dump/restore tables with INHERITS