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

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -