public inbox for [email protected]
help / color / mirror / Atom feedFrom: sud <[email protected]>
To: Erik Wienhold <[email protected]>
Cc: Greg Sabino Mullane <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Timestamp conversion Error in dynamic sql script
Date: Thu, 4 Apr 2024 01:39:32 +0530
Message-ID: <CAD=mzVVdF__7DspNX4D1T=m0aRpw9BRCSkRCugMG=W82B3uFng@mail.gmail.com> (raw)
In-Reply-To: <6oywkrrg5bzvnmorg7l3kdvzc2ipejm2xx3o5qaam57chuacic@iu4pe64gjqoj>
References: <CAD=mzVVHrGgJ08SH8pECjTAH1EKE26ZdL26OjW3mcXhM-AZi2A@mail.gmail.com>
<m5bfxgtwkn6vasomhh3h36frkehjapftu74ebxattsyajxgq4w@uhxjzqsnqzyu>
<CAKAnmmJXnjoEJRxRd7az0pSZX6UDMeNG=5ZUgZmKgha2VVdmUw@mail.gmail.com>
<CAD=mzVXTjv4nY96MZ0sAxVsdsEFMXzB2gJkzD_T445R82YOt0g@mail.gmail.com>
<6oywkrrg5bzvnmorg7l3kdvzc2ipejm2xx3o5qaam57chuacic@iu4pe64gjqoj>
This one worked. Thank you so much.
On Wed, Apr 3, 2024 at 2:27 AM Erik Wienhold <[email protected]> wrote:
> On 2024-04-02 22:08 +0200, sud wrote:
> > On Tue, Apr 2, 2024 at 7:46 PM Greg Sabino Mullane <[email protected]>
> > wrote:
> >
> > Now this block seems to be failing near the "LIKE" operator. Isn't it
> > allowed to add the check constraints along with the CREATE TABLE
> statement?
> >
> > [...]
> >
> > EXECUTE format('
> > CREATE TABLE parent_table_%s (
> > CHECK (partition_key >= ''%s'' AND partition_key < ''%s'' )
> > * ) LIKE (parent_table including all);',*
> > TO_CHAR(start_date + make_interval(days=>i),'YYYY_MM_DD'),
> > (start_date + make_interval(days=>i))::timestamptz ,
> > (start_date + make_interval(days=>i))::timestamptz
> > );
> >
> > [...]
> >
> > *SQL Error [42601]: ERROR: syntax error at or near "LIKE"Where: PL/pgSQL
> > function inline_code_block line 8 at EXECUTE*
> > *Error position: *
>
> The LIKE clause goes inside the parenthesis along with the column and
> constraint definitions, i.e.:
>
> CREATE TABLE parent_table_yyyy_mm_dd (
> LIKE parent_table,
> CHECK (...)
> );
>
> --
> Erik
>
view thread (3+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Timestamp conversion Error in dynamic sql script
In-Reply-To: <CAD=mzVVdF__7DspNX4D1T=m0aRpw9BRCSkRCugMG=W82B3uFng@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox