Postgres (8.0.2., Redshift) SQL function definition, error "The cursor is not located inside a statement" -


i super noob in postgresql. need define func map: int --> datetime after reading documentation i've come this:

 create function fut(num integer) returns datetime  -- convert unix time integer datetime timestamp     $$ select timestamp 'epoch'+interval '1 second'*num; $$     language plpgsql;  select fut(500); 

but returns

the cursor not located inside statement! 

could please point me doing wrong here?

as far knew redshift doesn't permit user-defined functions. yeah: http://docs.aws.amazon.com/redshift/latest/dg/c_unsupported-postgresql-features.html : user-defined functions , stored procedures. think you're plain out of luck.

a search redshift epoch timestamp or redshift to_timestamp finds lots of other people have looked already:

etc.

the sensible answers rely on:

timestamp 'epoch' + myunixtime * interval '1 second ' 

which appear doing. best going get, because redshift not support user-defined functions.


Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

SQL Server - MyCTE query based on 24 hour period (next day) -

php - Using str_replace to translate a MySQL Table in html -