How to add a new psql command ? - Mailing list pgsql-general

From Quentin Di-Fant
Subject How to add a new psql command ?
Date
Msg-id CAM2ovs-Q8w8=e9kfd=+KJRArg6wxWEOMCYNPY1w1adv-4fDUJQ@mail.gmail.com
Whole thread Raw
Responses Re: How to add a new psql command ?  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-general
Hello,

I was wondering : is it possible to add directly a new psql command which can be run anytime in our PostgreSQL interpreter like any other normal psql commands ?

I explain myself : in the PostgreSQL interpreter, when the command "\h" or "\help" is written in the shell, we can see all the commands we have at our disposal. We can also of course write our proper functions, in python scripts for example, and run them direclty in one of our databases. But I was wondering if it was possible to add directly a command, like \copy, \select, .... For example, let's say I create a new command called \resume which will call my own-made python script, and I would want this command to be part of the list of commands we see when we type \h.

Is it even possible ? And if it's possible, how can I achieve that ?

Thanks for your attention and I thank you in advance for all the informations you will possibly give me.

Cordially.

pgsql-general by date:

Previous
From: Maximilian Tyrtania
Date:
Subject: Re: Connection issue
Next
From: Pavel Stehule
Date:
Subject: Re: How to add a new psql command ?