Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k44eA-0002DF-OD for pgsql-admin@arkaria.postgresql.org; Fri, 07 Aug 2020 15:51:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k44e9-0004Ap-N2 for pgsql-admin@arkaria.postgresql.org; Fri, 07 Aug 2020 15:51:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k44e9-0004Ah-FJ for pgsql-admin@lists.postgresql.org; Fri, 07 Aug 2020 15:51:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k44e2-0007RI-Vk for pgsql-admin@postgresql.org; Fri, 07 Aug 2020 15:51:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 077Fnsn72755424; Fri, 7 Aug 2020 11:49:54 -0400 From: Tom Lane To: Ravi Tammineni cc: "pgsql-admin@postgresql.org" Subject: Re: PostgreSQL-11 partition creation issue In-reply-to: References: Comments: In-reply-to Ravi Tammineni message dated "Fri, 07 Aug 2020 14:49:09 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2755422.1596815394.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 07 Aug 2020 11:49:54 -0400 Message-ID: <2755423.1596815394@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ravi Tammineni 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: =3D# 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