When I query my test_table I get back the following rows:
SELECT *
FROM test_table;
id event_dates_array
1 {'2012-01-01', '2013-01-01'}
2 {'2015-01-01', '2016-01-01'}
The event_dates_array is a date array column.
I want the query to return the event_dates_array formatted so that the date arrays only show the years, like so:
id event_dates_array
1 {'2012', '2013'}
2 {'2015', '2016'}
You can do this with normal date columns like so: date_part('year', event_dates)
But how do you do it for date array columns?