Re: [RFC] Add an until-0 loop in psql

2018-04-28 Thread Corey Huinker
> > > I did it too. It is not too hard - there was not a agreement on syntax. > > can be nice some like CTE > > WITH PROCEDURE x(a int, b int) AS ... $$ SELECT x(10); > I've seen "WITH function" syntax in Oracle (here's an example:

Re: [RFC] Add an until-0 loop in psql

2018-04-27 Thread Corey Huinker
>> What you don't see here is that you're using your psql process's >> available open file handles as a stack, and when you hit that limit psql >> will fail. If you remove that limit, then you get a bit further before psql >> segfaults on you. I think I got ~2700 files deep before that happened.

Re: [RFC] Add an until-0 loop in psql

2018-04-27 Thread Corey Huinker
As of v11, DO blocks can do transactions. I think this will meet your needs. A loop that starts at point X in the code and terminates at point Y has to know how to jump back in the file (if there even is a file!) to point X and re-interpret commands as it makes it's way back through the "file"

Re: \describe*

2018-01-26 Thread Corey Huinker
> > It would be about as hard to memorize \describe-schemas as it is to > memorize \dn: > You'd have to remember that it is "-" and not "_", that it is "describe", > not "desc" > and that it is "schemas", not "schema". > You wouldn't memorize them. You'd discover them with tab completion. Type

Re: CREATE ROUTINE MAPPING

2018-01-17 Thread Corey Huinker
> > CREATE ROUTINE MAPPING local_routine_name > > > FOR (FUNCTION | PROCEDURE) remote_routine_name ( [ [ argmode ] [ > argname ] > > > argtype [ { DEFAULT | = } default_expr ] [, ...] ] ) > > >[ RETURNS rettype > > > | RETURNS TABLE ( column_name column_type [, ...] ) ] > > > SERVER

Re: CREATE ROUTINE MAPPING

2018-01-12 Thread Corey Huinker
> > > > It goes on from there, but I think there's a reasonable interpretation > of this which allows us to use the same syntax as CREATE > (FUNCTION|PROCEDURE), apart from the body, e.g.: > > CREATE ROUTINE MAPPING local_routine_name > FOR (FUNCTION | PROCEDURE) remote_routine_name ( [ [ argmode

Re: CREATE ROUTINE MAPPING

2018-01-12 Thread Corey Huinker
> > PostgreSQL allows function overloading, which means that there can be > multiple functions with same name differing in argument types. So, the > syntax has to include the input parameters or their types at least. > "local_routine_name" and "remote_routine_spec" were my own paraphrasings of

CREATE ROUTINE MAPPING

2018-01-11 Thread Corey Huinker
A few months ago, I was researching ways for formalizing calling functions on one postgres instance from another. RPC, basically. In doing so, I stumbled across an obscure part of the the SQL Standard called ROUTINE MAPPING, which is exactly what I'm looking for. The syntax specified is, roughly:

<    1   2   3   4