synapse/cmd.sh
changeset 9 c636ea2e8ee1
parent 8 b92f5cceab78
child 10 aaa61e5b4526
equal deleted inserted replaced
8:b92f5cceab78 9:c636ea2e8ee1
    54 
    54 
    55 ### create unts() func
    55 ### create unts() func
    56 if [ "$MODE" = "unts" ]; then
    56 if [ "$MODE" = "unts" ]; then
    57 	echo "Creating unts() function; needs write access or you can simply copy the following code into psql."
    57 	echo "Creating unts() function; needs write access or you can simply copy the following code into psql."
    58 	echo " "
    58 	echo " "
    59 	SQL='CREATE OR REPLACE FUNCTION public.unts(bigint)
    59 	SQL="CREATE OR REPLACE FUNCTION public.unts(bigint)
    60  RETURNS timestamp with time zone
    60  RETURNS timestamp with time zone
    61  LANGUAGE sql
    61  LANGUAGE sql
    62  IMMUTABLE STRICT
    62  IMMUTABLE STRICT
    63 AS $function$
    63 AS \$function$
    64   SELECT TIMESTAMP WITH TIME ZONE ''epoch'' + $1/1000 * INTERVAL ''1 second''
    64   SELECT TIMESTAMP WITH TIME ZONE 'epoch' + \$1/1000 * INTERVAL '1 second'
    65 $function$'
    65 \$function$"
    66 	echo "${SQL}"
    66 	echo "${SQL}"
    67 	echo " "
    67 	echo " "
    68 	$CMD "${SQL}"
    68 	$CMD "${SQL}"
    69 	exit
    69 	exit
    70 fi
    70 fi