Re: proposal: PL/Pythonu - function ereport - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal: PL/Pythonu - function ereport
Date
Msg-id CAFj8pRB+te3sh=0JOwyHnbbvZL1ei7pfX6TXj076Cg6sJP81tw@mail.gmail.com
Whole thread Raw
In response to Re: proposal: PL/Pythonu - function ereport  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers
Hi

>
> I though about it lot of, and I see a  the core of problems in orthogonal
> constructed exceptions in Python and Postgres. We working with statements
> elog, ereport, RAISE EXCEPTION - and these statements are much more like
> templates - can generate any possible exception. Python is based on working
> with instances of predefined exceptions. And it is core of problem.
> Template like class cannot be ancestor of instance oriented classes. This
> is task for somebody who knows well OOP and meta OOP in Python - total

I've been following this discussion with great interest, because PL/Java
also is rather overdue for tackling the same issues: it has some partial
ability to catch things from PostgreSQL and even examine them in proper
detail, but very limited ability to throw things as information-rich as
is possible from C with ereport. And that work is not as far along as
you are with PL/Python, there is just a preliminary design/discussion
wiki document at
  https://github.com/tada/pljava/wiki/Thoughts-on-logging

I was unaware of this project in PL/Pythonu when I began it, then added
the reference when I saw this discussion.


I read your article and it is exactly same situation.

It is conflict between procedural (PostgreSQL) and OOP (Python, Java) API. I see possible solution in design independent class hierarchies - static (buildin exceptions) and dynamic (custom exceptions). It cannot be mixed, but there can be some abstract ancestor. Second solution is defensive - using procedural API for custom exceptions - what i doing in PLPythonu.

Regards

Pavel

pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: Why format() adds double quote?
Next
From: Masahiko Sawada
Date:
Subject: Re: Existence check for suitable index in advance when concurrently refreshing.