Re: PostgreSQL-11 partition creation issue

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PostgreSQL-11 partition creation issue
Дата
Msg-id 2755423.1596815394@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PostgreSQL-11 partition creation issue  (Ravi Tammineni <RTammineni@jackhenry.com>)
Список pgsql-admin
Ravi Tammineni <RTammineni@jackhenry.com> writes:
> Getting the following error.

> ERROR:  syntax error at or near "/"
> LINE 7: ) partition by to_timestamp(osn_timestamp/1000)::date;

You have the syntax wrong, and once you get past that, you'll also
find that you're trying to use a non-immutable function in a partition
expression (because casting from timestamptz to date depends on the
prevailing timezone).  Something like this would work, perhaps:

=# CREATE TABLE public.oauth_server_nonce_new (
    osn_id integer NOT NULL,
    osn_consumer_key character varying(64) NOT NULL,
    osn_token character varying(64) NOT NULL,
    osn_timestamp bigint NOT NULL,
    osn_nonce character varying(80) NOT NULL
) partition by range (((to_timestamp(osn_timestamp/1000) at time zone 'UTC')::date));
CREATE TABLE

            regards, tom lane



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

Предыдущее
От: Ravi Tammineni
Дата:
Сообщение: PostgreSQL-11 partition creation issue
Следующее
От: Don Seiler
Дата:
Сообщение: Recovery from WAL archives not advancing timeline?