With the function below I want to make this function compare the current date with the date stored in the database.
create table mercado(
id integer,
diaEntrega date,
valor integer
);
insert into mercado values (2,'7-02-18',12);
CREATE OR REPLACE FUNCTION get_d () RETURNS date AS
$$
DECLARE
dataAtual date;
varValor integer;
dataFinalizada date;
BEGIN
SELECT CURRENT_DATE INTO dataAtual;
/*SELECT diaEntrega FROM mercado WHERE '7-02-18' = diaEntrega INTO dataFinalizada;*/ /*OBS:DESTA FORMA FUNCIONA*/
SELECT diaEntrega FROM mercado WHERE dataAtual = diaEntrega INTO dataFinalizada;
return dataFinalizada;
END;
$$ LANGUAGE 'plpgsql';