PostgreSQL compilation error

2

Someone could tell me if there is an error in the query below:

select name, cast(Extract(day from payday) as int) as 'day' from loan;

I can not find the reason for having a compile error in the URI.

    
asked by anonymous 05.11.2018 / 01:33

1 answer

3

I thought the problem would be in cast ; I was creating this fiddle and realized that the error message ( 42601: syntax error at or near "'day'" ) is related to the alias , not the extract .

Removing quotation marks, the problem is solved:

select name, cast(Extract(day from payday) as int) as day from loan;
    
05.11.2018 / 12:15