如何退出 PSQL CREATE FUNCTION 屏幕
How to exit PSQL CREATE FUNCTION screens
我是在 Postgres 中编写函数的新手..
我不想完全退出 PSQL,(我知道 CTRL+D 会这样做,)但我似乎卡在了 CREATE FUNCTION 屏幕上。
mattswheels=# CREATE OR REPLACE FUNCTION 99_cents(money)
mattswheels-# RETURNS money
mattswheels-# LANGUAGE plpgsql
mattswheels-# LEAKPROOF
mattswheels-# AS $function$
mattswheels$# DECLARE
mattswheels$# new_price money;
mattswheels$# size int;
mattswheels$# BEGIN
mattswheels$# size := char_length(money);
mattswheels$# RETURN size;
mattswheels$# END;
mattswheels$#
mattswheels$# \q
mattswheels$# halp
mattswheels$# ;
mattswheels$# ;
mattswheels$# ;
mattswheels$# ;
mattswheels$# help
mattswheels$# ;
mattswheels$# \?
首先,我发现 postgres 函数不能以数字开头。
ERROR: syntax error at or near ".99"
LINE 1: CREATE OR REPLACE FUNCTION public.99cents(money)
其次,要退出 $function$
声明上方的问题,需要这样关闭:
$function$;
据我所知,没有其他击键可以退出 CREATE FUNCTION 屏幕,除非使用 CTRL+D 完全退出 PSQL。
试试 CTRL+C。它丢弃最后一个没有终止引号的查询。
我是在 Postgres 中编写函数的新手..
我不想完全退出 PSQL,(我知道 CTRL+D 会这样做,)但我似乎卡在了 CREATE FUNCTION 屏幕上。
mattswheels=# CREATE OR REPLACE FUNCTION 99_cents(money)
mattswheels-# RETURNS money
mattswheels-# LANGUAGE plpgsql
mattswheels-# LEAKPROOF
mattswheels-# AS $function$
mattswheels$# DECLARE
mattswheels$# new_price money;
mattswheels$# size int;
mattswheels$# BEGIN
mattswheels$# size := char_length(money);
mattswheels$# RETURN size;
mattswheels$# END;
mattswheels$#
mattswheels$# \q
mattswheels$# halp
mattswheels$# ;
mattswheels$# ;
mattswheels$# ;
mattswheels$# ;
mattswheels$# help
mattswheels$# ;
mattswheels$# \?
首先,我发现 postgres 函数不能以数字开头。
ERROR: syntax error at or near ".99"
LINE 1: CREATE OR REPLACE FUNCTION public.99cents(money)
其次,要退出 $function$
声明上方的问题,需要这样关闭:
$function$;
据我所知,没有其他击键可以退出 CREATE FUNCTION 屏幕,除非使用 CTRL+D 完全退出 PSQL。
试试 CTRL+C。它丢弃最后一个没有终止引号的查询。