Function and Procedure with same signature?

2024-02-09 Thread Deepak M
Hello Hackers,

Folks, When tried to create a function with the same signature as procedure
it fails.

postgres=#  create or replace procedure obj1(char) language plpgsql as $$
 begin select $1; end; $$;
CREATE PROCEDURE
postgres=# create or replace function obj1(char) returns void language sql
as $$ select $1 $$;
ERROR:  cannot change routine kind
DETAIL:  "obj1" is a procedure.

any reason for failures?
Can procedure or function can be defined with the same signature i.e. name
and IN arguments ?
as callable for both is different.?


Re: A tiny improvement of psql

2023-12-26 Thread Deepak M
On repeating the execution of last command in psql, we can always use below
command to send current query buffer to server.

\g
\gx  (with expanded output mode, that always come handy.)

On Tue, Dec 26, 2023 at 9:56 PM Kevin Wang  wrote:

> Hello hackers!
>
> I am an Oracle/PostgreSQL DBA, I am not a PG hacker.  During my daily job,
> I find a pain that should be fixed.
>
> As you know, we can use the UP arrow key to get the previous command to
> avoid extra typing. This is a wonderful feature to save the lives of every
> DBA. However, if I type the commands like this sequence: A, B, B, B, B, B,
> B,  as you can see, B is the last command I execute.
>
> But if I try to get command A, I have to press the UP key 7 times.  I
> think the best way is: when you press the UP key, plsql should show the
> command that is different from the previous command, so the recall sequence
> should be B -> A, not B -> B -> ... -> A.  Then I only press the UP key 2
> times to get command A.
>
> I think this should change little code in psql, but it will make all DBA's
> lives much easier.  This is a strong requirement from the real DBA. Hope to
> get some feedback on this.
>
> Another requirement is: could we use / to repeat executing the last
> command in plsql just like sqlplus in Oracle?
>
> I will try to learn how to fix it sooner or later, but if some
> proficient hacker focuses on this, it can be fixed quickly, I guess.
>
> Thoughts?
>
> Regards,
>
> Kevin
>