Re: [SQL] explicit casts

2011-01-05 Thread Iuri Sampaio
m-dd'), -1),'Day') as prev_month, trunc(to_date('2010-01-02', '-mm-dd'), 'year') as beginning_of_year, to_char(last_day(add_months('2010-01-02', -1))::date, 'DD') as days_in_last_month, to_char(add_months(to_date('201

[SQL] explicit casts

2011-01-05 Thread Iuri Sampaio
Hi there, I installed postgresql 8.4 on my box and now i have troubles with the following query regarding explicit casts. select to_char(trunc(to_date(:the_date, '-mm-dd'), 'Month'), 'fmMonth') as month, to_char(trunc(to_date(:the_date, '-mm-dd'), 'Month'), '') as year, t

[SQL] sql query - create replace function

2007-12-19 Thread Iuri Sampaio
Hi all, I created a script to install postgresql. One of the steps is to run a sql query. the problem is that i need to run the query as postgres user, plus it needs to be at psql shell prompt command line, i.e: # from your shell prompt enter: $ psql # From the psql prompt enter the follow plp