Make better use of existing enums in plpgsql

Lists: pgsql-hackers
From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Make better use of existing enums in plpgsql
Date: 2016-08-19 14:56:20
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

plpgsql.h defines a number of enums, but most of the code passes them
around as ints. The attached patch updates structs and function
prototypes to take enum types instead. This clarifies the struct
definitions in plpgsql.h in particular.

I didn't deal with the PLPGSQL_RC_* symbols, since they are only used in
pl_exec.c (could be moved there?), and it would bloat this patch.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Make-better-use-of-existing-enums-in-plpgsql.patch text/x-patch 16.1 KB

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Make better use of existing enums in plpgsql
Date: 2016-09-04 16:26:26
Message-ID: CAFj8pRC6SSCEtbr0+2jrq8KqWwLzF9TNwrTiq+r3aUvcVNZ05Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Hi

2016-08-19 16:56 GMT+02:00 Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com>:

> plpgsql.h defines a number of enums, but most of the code passes them
> around as ints. The attached patch updates structs and function
> prototypes to take enum types instead. This clarifies the struct
> definitions in plpgsql.h in particular.
>

I am sending review of this trivial patch.

1. No problems with patching, compiling
2. all regress tests passed
3. There are not any visible change, so tests, docs are not necessary
4. Using enum instead int is generally good idea

I will mark this patch as ready for commiters.

>
> I didn't deal with the PLPGSQL_RC_* symbols, since they are only used in
> pl_exec.c (could be moved there?), and it would bloat this patch.
>

It is good idea. PLPGSQL_RC_* should be private in pl_exec.c

Regards

Pavel

>
> --
> Peter Eisentraut http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>


From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Make better use of existing enums in plpgsql
Date: 2016-09-09 14:23:59
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 9/4/16 12:26 PM, Pavel Stehule wrote:
> I am sending review of this trivial patch.
>
> 1. No problems with patching, compiling
> 2. all regress tests passed
> 3. There are not any visible change, so tests, docs are not necessary
> 4. Using enum instead int is generally good idea
>
> I will mark this patch as ready for commiters.

Committed, thanks.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services