TYpecasting Postgresql issue

ERROR: operator does not exist: timestamp without time zone + double precision
LINE 3: where rnum <= ((INDATE + (DAYS)) - INDATE+1))…

                                      ^

select count(*)
from (select rnum from (select ROW_NUMBER () OVER() rnum
from pg_class) a1
where rnum <= ((INDATE + (DAYS)) - INDATE+1))a5
where to_char(INDATE +rnum-1, ‘DY’ ) in ( ‘SAT’, ‘SUN’)
CONTEXT: PL/pgSQL function gcars_batch.fnc_get_weekenddays(timestamp without time zone,double precision)

Tried interval & numeric but that’s not working.

you can add an interval to a timestamp:

ostgres=# select now() + '1 day'::interval;
           ?column?            
-------------------------------
 2023-01-26 15:06:50.860388+00
(1 row)

Added your suggestion.Still getting an error.

ERROR: operator does not exist: timestamp without time zone + double precision
LINE 3: where rnum <= ((INDATE + (DAYS)) - INDATE+'1 …
^

select count(*)
from (select rnum from (select ROW_NUMBER () OVER() rnum
from pg_class) a1
where rnum <= ((INDATE + (DAYS)) - INDATE+‘1 DAY’::INTERVAL))a5
where to_char(INDATE +rnum-1, ‘DY’ ) in ( ‘SAT’, ‘SUN’)

ja, ist halt immer noch falsch…

1 „Gefällt mir“

Dieses Thema wurde automatisch 60 Tage nach der letzten Antwort geschlossen. Es sind keine neuen Antworten mehr erlaubt.