Re: proposal: PL/Pythonu - function ereport

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: Catalin Iacob <iacobcatalin(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: PL/Pythonu - function ereport
Date: 2016-01-27 16:00:16
Message-ID: CAFj8pRB+te3sh=0JOwyHnbbvZL1ei7pfX6TXj076Cg6sJP81tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2016-01-27 16:01:24 Re: Existence check for suitable index in advance when concurrently refreshing.
Previous Message Daniel Verite 2016-01-27 15:37:14 Re: Why format() adds double quote?