Re: PostgreSQL-11 partition creation issue - Mailing list pgsql-admin

From Tom Lane
Subject Re: PostgreSQL-11 partition creation issue
Date
Msg-id 2755423.1596815394@sss.pgh.pa.us
Whole thread Raw
In response to PostgreSQL-11 partition creation issue  (Ravi Tammineni <RTammineni@jackhenry.com>)
List 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 by date:

Previous
From: Ravi Tammineni
Date:
Subject: PostgreSQL-11 partition creation issue
Next
From: Don Seiler
Date:
Subject: Recovery from WAL archives not advancing timeline?