pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: ERROR: operator does not exist: timestamp without time zone + integer
Date: Tue, 30 Apr 2019 11:24:55 +0200
Message-ID: <12869367-4dae-37ee-0a2e-c94d04fc9427@gmx.net> (raw)
In-Reply-To: <BL0PR01MB51876A1315E10193A51DF8FA9B3A0@BL0PR01MB5187.prod.exchangelabs.com>
References: <BL0PR01MB51876A1315E10193A51DF8FA9B3A0@BL0PR01MB5187.prod.exchangelabs.com>

Daulat Ram schrieb am 30.04.2019 um 05:46:
> We are getting an ERROR:  “operator does not exist: timestamp without
> time zone + integer “ while creating table in postgres. The same
> script is working fine in Oracle, I know there are some changes in
> postgres but I am unable to identify . Please suggest how we can
> create it successfully in postgres.
> 
> 
> kbdb=# CREATE TABLE motif_site (
> kbdb(#         topic_match_conf_threshold bigint DEFAULT 3,
> kbdb(#         retention_period bigint DEFAULT 3,
> kbdb(#         site_mode_date timestamp NOT NULL DEFAULT date_trunc('day', LOCALTIMESTAMP)+7,
> kbdb(#         reload_submission_date timestamp,
> kbdb(#         socket_time_out bigint DEFAULT 2500,
> kbdb(#         reload_date timestamp,
> kbdb(#         marked_content_tag varchar(1024) DEFAULT 'pagecontent konabody intellitxt echotopic contentpaneopen postbody realtext newscontent content contentbody posttext##post_message_.*',
> kbdb(#         crawl_batch_size_lower_limit numeric(38) NOT NULL DEFAULT 20,
> kbdb(#         site_name varchar(512) NOT NULL,
> kbdb(#         crawl_batch_size_upper_limit numeric(38) NOT NULL DEFAULT 40,
> kbdb(#         mtg numeric(38) DEFAULT 2000,
> kbdb(#         enabled numeric(38) NOT NULL DEFAULT 0,
> kbdb(#         root_url varchar(1024),
> kbdb(#         blocked_content_tag varchar(1024) DEFAULT 'nointellitxt noechotopic',
> kbdb(#         match_params varchar(1024),
> kbdb(#         tf_data_source varchar(256) DEFAULT 'Web',
> kbdb(#         site_id numeric(38) NOT NULL
> kbdb(# ) ;
> ERROR:  operator does not exist: timestamp without time zone + integer
> HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

You can only add integers to DATEs, not to timestamps. 

To add a number of days to a timestamp, you need to use an interval:

   date_trunc('day', LOCALTIMESTAMP) + interval '7 day'

Thomas





view thread (8+ messages)  latest in thread

Message-ID: <12869367-4dae-37ee-0a2e-c94d04fc9427@gmx.net>
Permalink:  ../12869367-4dae-37ee-0a2e-c94d04fc9427@gmx.net/
Also on:    postgresql.org/message-id/12869367-4dae-37ee-0a2e-c94d04fc9427@gmx.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: ERROR: operator does not exist: timestamp without time zone + integer
  In-Reply-To: <12869367-4dae-37ee-0a2e-c94d04fc9427@gmx.net>
  References: <BL0PR01MB51876A1315E10193A51DF8FA9B3A0@BL0PR01MB5187.prod.exchangelabs.com> <12869367-4dae-37ee-0a2e-c94d04fc9427@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox