>  select user_name, date_part( 'epoch' , timestamp 'acct_timestamp') from
> tbacct limit 2;
> 
> it said ERROR:  Bad timestamp external representation 'acct_timestamp'
> how should i represent date_part( 'epoch' , timestamp 'acct_timestamp')
> to work?

select user_name, date_part ('epoch', acct_timestamp) from tbacct limit 2;
should work... the single quotes are making a literal string value, so
your query is saying take the epoch of the timestamp represented by the
literal 'acct_timestamp' rather than the value of the field.

Reply via email to