pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
partitioned tables and contrib/sepgsql
61+ messages / 7 participants
[nested] [flat]

Commits from this thread:
  2017-04-09 86fa9b2d1b  Make sepgsql regression tests robust vs. collation differences
  2017-04-09 25542d77dd  Add partitioned table support to sepgsql
  2017-04-06 af8a94d18d  Silence uninitialized variable compiler warning in sepgsql
  2017-04-06 bd190eae36 dd93afca3a 5fcf1f4e0a 7e71081426 649cd9085e 1d6f5b446f  Silence compiler warning in sepgsql
* partitioned tables and contrib/sepgsql
@ 2017-03-09 14:47 Stephen Frost <sfrost@snowman.net>
  2017-03-09 14:59 ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  0 siblings, 2 replies; 61+ messages in thread

From: Stephen Frost @ 2017-03-09 14:47 UTC (permalink / raw)
  To: pgsql-hackers

Greetings,

While going over the contrib modules, I noticed that sepgsql was not
updated for partitioned tables.  What that appears to mean is that it's
not possible to define labels on partitioned tables.  As I recall,
accessing the parent of a table will, similar to the GRANT system, not
perform checkes against the child tables, meaning that there's no way to
have SELinux checks properly enforced when partitioned tables are being
used.

This is an issue which should be resolved for PG10, so I'll add it to
the open items list.

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
@ 2017-03-09 14:59 ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-09 15:05   ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  1 sibling, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-03-09 14:59 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; +Cc: pgsql-hackers

On Thu, Mar 9, 2017 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
> Greetings,
>
> While going over the contrib modules, I noticed that sepgsql was not
> updated for partitioned tables.  What that appears to mean is that it's
> not possible to define labels on partitioned tables.  As I recall,
> accessing the parent of a table will, similar to the GRANT system, not
> perform checkes against the child tables, meaning that there's no way to
> have SELinux checks properly enforced when partitioned tables are being
> used.

I'll start taking a look at this. Presumably we'd just extend existing
object_access_hooks to cover partitioned tables?

>
> This is an issue which should be resolved for PG10, so I'll add it to
> the open items list.

I'll grab it. Thanks.

--Mike


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-09 14:59 ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-03-09 15:05   ` Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 61+ messages in thread

From: Stephen Frost @ 2017-03-09 15:05 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: pgsql-hackers

Mike,

* Mike Palmiotto (mike.palmiotto@crunchydata.com) wrote:
> On Thu, Mar 9, 2017 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
> > While going over the contrib modules, I noticed that sepgsql was not
> > updated for partitioned tables.  What that appears to mean is that it's
> > not possible to define labels on partitioned tables.  As I recall,
> > accessing the parent of a table will, similar to the GRANT system, not
> > perform checkes against the child tables, meaning that there's no way to
> > have SELinux checks properly enforced when partitioned tables are being
> > used.
> 
> I'll start taking a look at this. Presumably we'd just extend existing
> object_access_hooks to cover partitioned tables?

At least on first blush that seems like the right approach.  We'll need
to make sure that the SECURITY LABEL system will properly work with
partitioned tables too, of course, and that the checks are called when a
user queries a partitioned table.  Then we'll need regression tests to
make sure we get it all correct and don't screw it up in the future. ;)

> > This is an issue which should be resolved for PG10, so I'll add it to
> > the open items list.
> 
> I'll grab it. Thanks.

Excellent, thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
@ 2017-03-27 14:47 ` Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  1 sibling, 1 reply; 61+ messages in thread

From: Robert Haas @ 2017-03-27 14:47 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; +Cc: pgsql-hackers

On Thu, Mar 9, 2017 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
> While going over the contrib modules, I noticed that sepgsql was not
> updated for partitioned tables.  What that appears to mean is that it's
> not possible to define labels on partitioned tables.

It works for me:

rhaas=# load 'dummy_seclabel';
LOAD
rhaas=# create table foo (a int, b text) partition by range (a);
CREATE TABLE
rhaas=# security label on table foo is 'classified';
SECURITY LABEL

What exactly is the problem you're seeing?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-03-27 15:22   ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-03-27 15:22 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Mon, Mar 27, 2017 at 10:47 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, Mar 9, 2017 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
>> While going over the contrib modules, I noticed that sepgsql was not
>> updated for partitioned tables.  What that appears to mean is that it's
>> not possible to define labels on partitioned tables.
>
> It works for me:
>
> rhaas=# load 'dummy_seclabel';
> LOAD
> rhaas=# create table foo (a int, b text) partition by range (a);
> CREATE TABLE
> rhaas=# security label on table foo is 'classified';
> SECURITY LABEL
>
> What exactly is the problem you're seeing?

IIRC the initial concern was that contrib/sepgsql was not updated for
RELKIND_PARTITIONED_TABLE, so the post-create hook would not work
properly for partitioned tables.

I've looked into it a bit and saw a post-alter hook in
StoreCatalogInheritance1. It seems like it may just be an issue of
adding the RELKIND_PARTITIONED_TABLE to sepgsql_relation_post_create.

-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-03-27 15:46     ` Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Robert Haas @ 2017-03-27 15:46 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Mon, Mar 27, 2017 at 11:22 AM, Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
> On Mon, Mar 27, 2017 at 10:47 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>> On Thu, Mar 9, 2017 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
>>> While going over the contrib modules, I noticed that sepgsql was not
>>> updated for partitioned tables.  What that appears to mean is that it's
>>> not possible to define labels on partitioned tables.
>>
>> It works for me:
>>
>> rhaas=# load 'dummy_seclabel';
>> LOAD
>> rhaas=# create table foo (a int, b text) partition by range (a);
>> CREATE TABLE
>> rhaas=# security label on table foo is 'classified';
>> SECURITY LABEL
>>
>> What exactly is the problem you're seeing?
>
> IIRC the initial concern was that contrib/sepgsql was not updated for
> RELKIND_PARTITIONED_TABLE, so the post-create hook would not work
> properly for partitioned tables.
>
> I've looked into it a bit and saw a post-alter hook in
> StoreCatalogInheritance1. It seems like it may just be an issue of
> adding the RELKIND_PARTITIONED_TABLE to sepgsql_relation_post_create.

I thought that kind of thing might be the issue, but it didn't seem to
match Stephen's description.  Adding RELKIND_PARTITIONED_TABLE to that
function seems like it would probably be sufficient to make that hook
work, although that would need to be tested, but there are numerous
other references to RELKIND_RELATION in contrib/sepgsql, some of which
probably also need to be updated to consider
RELKIND_PARTITIONED_TABLE.

In my view, this is really an enhancement to sepgsql to handle a new
PostgreSQL feature rather than a defect in the partitioning commit, so
I don't think it falls on Amit Langote (as the author) or me (as the
committer) to fix.  There might similarly be updates to sepgsql to do
something with permissions on logical replication's new publication
and subscription objects, but we should similarly regard those as
possible new features, not things that Petr or Peter need to work on.
 Note that sepgsql hasn't been updated to work with RLS yet, either,
but we didn't regard that as an open item for RLS, or if we did the
resolution was just to document it.  I am not opposed to giving a
little more time to get this straightened out, but if a patch doesn't
show up fairly soon then I think we should just document that sepgsql
doesn't support partitioned tables in v10.  sepgsql has a fairly
lengthy list of implementation restrictions already, so one more is
not going to kill anybody -- or if it will then that person should
produce a patch soon.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-03-27 16:09       ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-03-27 16:09 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Mon, Mar 27, 2017 at 11:46 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Mar 27, 2017 at 11:22 AM, Mike Palmiotto
> <mike.palmiotto@crunchydata.com> wrote:
>> On Mon, Mar 27, 2017 at 10:47 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>>> On Thu, Mar 9, 2017 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
>>>> While going over the contrib modules, I noticed that sepgsql was not
>>>> updated for partitioned tables.  What that appears to mean is that it's
>>>> not possible to define labels on partitioned tables.
>>>
>>> It works for me:
>>>
>>> rhaas=# load 'dummy_seclabel';
>>> LOAD
>>> rhaas=# create table foo (a int, b text) partition by range (a);
>>> CREATE TABLE
>>> rhaas=# security label on table foo is 'classified';
>>> SECURITY LABEL
>>>
>>> What exactly is the problem you're seeing?
>>
>> IIRC the initial concern was that contrib/sepgsql was not updated for
>> RELKIND_PARTITIONED_TABLE, so the post-create hook would not work
>> properly for partitioned tables.
>>
>> I've looked into it a bit and saw a post-alter hook in
>> StoreCatalogInheritance1. It seems like it may just be an issue of
>> adding the RELKIND_PARTITIONED_TABLE to sepgsql_relation_post_create.
>
> I thought that kind of thing might be the issue, but it didn't seem to
> match Stephen's description.  Adding RELKIND_PARTITIONED_TABLE to that
> function seems like it would probably be sufficient to make that hook
> work, although that would need to be tested, but there are numerous
> other references to RELKIND_RELATION in contrib/sepgsql, some of which
> probably also need to be updated to consider
> RELKIND_PARTITIONED_TABLE.

Agreed.

>
> In my view, this is really an enhancement to sepgsql to handle a new
> PostgreSQL feature rather than a defect in the partitioning commit, so
> I don't think it falls on Amit Langote (as the author) or me (as the
> committer) to fix.  There might similarly be updates to sepgsql to do
> something with permissions on logical replication's new publication
> and subscription objects, but we should similarly regard those as
> possible new features, not things that Petr or Peter need to work on.

I'll keep these items in mind for future reference. Thanks.

>  Note that sepgsql hasn't been updated to work with RLS yet, either,
> but we didn't regard that as an open item for RLS, or if we did the
> resolution was just to document it.  I am not opposed to giving a
> little more time to get this straightened out, but if a patch doesn't
> show up fairly soon then I think we should just document that sepgsql
> doesn't support partitioned tables in v10.  sepgsql has a fairly
> lengthy list of implementation restrictions already, so one more is
> not going to kill anybody -- or if it will then that person should
> produce a patch soon.

Okay, I'll make sure I get something fleshed out today or tomorrow.

-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-03-31 18:14         ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:42           ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  0 siblings, 2 replies; 61+ messages in thread

From: Mike Palmiotto @ 2017-03-31 18:14 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Mon, Mar 27, 2017 at 12:09 PM, Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
> On Mon, Mar 27, 2017 at 11:46 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>> <snip>
>>  Note that sepgsql hasn't been updated to work with RLS yet, either,
>> but we didn't regard that as an open item for RLS, or if we did the
>> resolution was just to document it.  I am not opposed to giving a
>> little more time to get this straightened out, but if a patch doesn't
>> show up fairly soon then I think we should just document that sepgsql
>> doesn't support partitioned tables in v10.  sepgsql has a fairly
>> lengthy list of implementation restrictions already, so one more is
>> not going to kill anybody -- or if it will then that person should
>> produce a patch soon.
>
> Okay, I'll make sure I get something fleshed out today or tomorrow.

Apologies for the delay. I was waffling over whether to reference
PartitionedRelationId in sepgsql, but ended up deciding to just handle
RELKIND_PARTITIONED_TABLE and treat the classOid as
RelationRelationId. Seeing as there is a relid in pg_class which
corresponds to the partitioned table, this chosen route seemed
acceptable.

Here is a demonstration of the partitioned table working with sepgsql hooks:
https://gist.github.com/anonymous/b10f476a95ae9cdd39b83ef872d4b1e6

Attached you will find two patches, which were rebased on master as of
156d388 (applied with `git am --revert [patch file]`). The first gets
rid of some pesky compiler warnings and the second implements the
sepgsql handling of partitioned tables.

Thanks,

-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

0002-Add-partitioned-table-support-to-sepgsql.patch (text/x-patch, 5.6K) download From 06463a4545c1cd0a2740e201d06a36b78dc2da8c Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Wed, 29 Mar 2017 14:59:37 +0000 Subject: [PATCH 2/2] Add partitioned table support to sepgsql Account for RELKIND_PARTITIONED_RELATIONS in sepgsql and treat the objects like regular relations. This allows for proper create/alter/drop hook behavior for partitioned tables. --- contrib/sepgsql/hooks.c | 1 + contrib/sepgsql/label.c | 4 +++- contrib/sepgsql/relation.c | 34 ++++++++++++++++++++++++---------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index 93cc8de..89e71e3 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -15,6 +15,7 @@ #include "catalog/pg_class.h" #include "catalog/pg_database.h" #include "catalog/pg_namespace.h" +#include "catalog/pg_partitioned_table.h" #include "catalog/pg_proc.h" #include "commands/seclabel.h" #include "executor/executor.h" diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index a404cd7..5111146 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -23,6 +23,7 @@ #include "catalog/pg_class.h" #include "catalog/pg_database.h" #include "catalog/pg_namespace.h" +#include "catalog/pg_partitioned_table.h" #include "catalog/pg_proc.h" #include "commands/dbcommands.h" #include "commands/seclabel.h" @@ -779,7 +780,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); - if (relForm->relkind == RELKIND_RELATION) + if (relForm->relkind == RELKIND_RELATION || + relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index fd6fe8b..93022d4 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -19,6 +19,7 @@ #include "catalog/pg_attribute.h" #include "catalog/pg_class.h" #include "catalog/pg_namespace.h" +#include "catalog/pg_partitioned_table.h" #include "commands/seclabel.h" #include "lib/stringinfo.h" #include "utils/builtins.h" @@ -54,12 +55,14 @@ sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum) ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind; /* * Only attributes within regular relation have individual security * labels. */ - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -135,8 +138,10 @@ sepgsql_attribute_drop(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -167,8 +172,11 @@ sepgsql_attribute_relabel(Oid relOid, AttrNumber attnum, { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); @@ -209,8 +217,11 @@ sepgsql_attribute_setattr(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; + + relkind = get_rel_relkind(relOid); - if (get_rel_relkind(relOid) != RELKIND_RELATION) + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -290,6 +301,7 @@ sepgsql_relation_post_create(Oid relOid) switch (classForm->relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -335,7 +347,8 @@ sepgsql_relation_post_create(Oid relOid) true); /* - * Assign the default security label on the new relation + * Assign the default security label on the new relation or partitioned + * table. */ object.classId = RelationRelationId; object.objectId = relOid; @@ -343,10 +356,10 @@ sepgsql_relation_post_create(Oid relOid) SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* - * We also assigns a default security label on columns of the new regular - * tables. + * We also assign a default security label on columns of a new table. */ - if (classForm->relkind == RELKIND_RELATION) + if (classForm->relkind == RELKIND_RELATION || + classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; @@ -421,6 +434,7 @@ sepgsql_relation_drop(Oid relOid) relkind = get_rel_relkind(relOid); switch (relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -483,7 +497,7 @@ sepgsql_relation_drop(Oid relOid) /* * check db_column:{drop} permission */ - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; @@ -529,7 +543,7 @@ sepgsql_relation_relabel(Oid relOid, const char *seclabel) uint16_t tclass = 0; relkind = get_rel_relkind(relOid); - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; -- 2.7.4
0001-Silence-some-sepgsql-compiler-warnings.patch (text/x-patch, 2.2K) download From 62d92d74d857c10ff47862b7fd7f1ac7d1561156 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Tue, 28 Mar 2017 16:44:54 +0000 Subject: [PATCH 1/2] Silence some sepgsql compiler warnings selinux/label.h includes stdbool.h, which redefines the bool type and results in a warning: assignment from incompatible pointer type for sepgsql_fmgr_hook. Move selinux/label.h above postgres.h, so the bool type is properly defined. Additionally, sepgsql throws compiler warnings due to possibly uninitialized tclass in code paths for indexes. Set tclass to a bogus -1 to silence these warnings. --- contrib/sepgsql/label.c | 4 ++-- contrib/sepgsql/relation.c | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..a404cd7 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -8,6 +8,8 @@ * * ------------------------------------------------------------------------- */ +#include <selinux/label.h> + #include "postgres.h" #include "access/heapam.h" @@ -37,8 +39,6 @@ #include "sepgsql.h" -#include <selinux/label.h> - /* * Saved hook entries (if stacked) */ diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..fd6fe8b 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -300,8 +300,10 @@ sepgsql_relation_post_create(Oid relOid) tclass = SEPG_CLASS_DB_VIEW; break; case RELKIND_INDEX: - /* deal with indexes specially; no need for tclass */ + /* other indexes are handled specially below; set tclass to -1 to + * silence compiler warning */ sepgsql_index_modify(relOid); + tclass = -1; goto out; default: /* ignore other relkinds */ @@ -432,7 +434,9 @@ sepgsql_relation_drop(Oid relOid) /* ignore indexes on toast tables */ if (get_rel_namespace(relOid) == PG_TOAST_NAMESPACE) return; - /* other indexes are handled specially below; no need for tclass */ + /* other indexes are handled specially below; set tclass to -1 to + * silence compiler warning */ + tclass = -1; break; default: /* ignore other relkinds */ -- 2.7.4
^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-03-31 18:42           ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  1 sibling, 0 replies; 61+ messages in thread

From: Mike Palmiotto @ 2017-03-31 18:42 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Fri, Mar 31, 2017 at 2:14 PM, Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
> On Mon, Mar 27, 2017 at 12:09 PM, Mike Palmiotto
> <mike.palmiotto@crunchydata.com> wrote:
>> On Mon, Mar 27, 2017 at 11:46 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>>> <snip>
>>>  Note that sepgsql hasn't been updated to work with RLS yet, either,
>>> but we didn't regard that as an open item for RLS, or if we did the
>>> resolution was just to document it.  I am not opposed to giving a
>>> little more time to get this straightened out, but if a patch doesn't
>>> show up fairly soon then I think we should just document that sepgsql
>>> doesn't support partitioned tables in v10.  sepgsql has a fairly
>>> lengthy list of implementation restrictions already, so one more is
>>> not going to kill anybody -- or if it will then that person should
>>> produce a patch soon.
>>
>> Okay, I'll make sure I get something fleshed out today or tomorrow.
>
> Apologies for the delay. I was waffling over whether to reference
> PartitionedRelationId in sepgsql, but ended up deciding to just handle
> RELKIND_PARTITIONED_TABLE and treat the classOid as
> RelationRelationId. Seeing as there is a relid in pg_class which
> corresponds to the partitioned table, this chosen route seemed
> acceptable.

Newest patches remove cruft from said waffling. No need to include
pg_partitioned_table.h if we're not referencing PartitionedRelationId.

>
> Here is a demonstration of the partitioned table working with sepgsql hooks:
> https://gist.github.com/anonymous/b10f476a95ae9cdd39b83ef872d4b1e6
>
> Attached you will find two patches, which were rebased on master as of
> 156d388 (applied with `git am --revert [patch file]`). The first gets
> rid of some pesky compiler warnings and the second implements the
> sepgsql handling of partitioned tables.

That should have read `git am --reject [patch file]`. Apologies for
the inaccuracy.

Thanks,

-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

0001-Silence-some-sepgsql-compiler-warnings.patch (text/x-patch, 2.2K) download From 82ff9a4e18d3baefa5530b8515e46cf8225519de Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Tue, 28 Mar 2017 16:44:54 +0000 Subject: [PATCH 1/2] Silence some sepgsql compiler warnings selinux/label.h includes stdbool.h, which redefines the bool type and results in a warning: assignment from incompatible pointer type for sepgsql_fmgr_hook. Move selinux/label.h above postgres.h, so the bool type is properly defined. Additionally, sepgsql throws compiler warnings due to possibly uninitialized tclass in code paths for indexes. Set tclass to a bogus -1 to silence these warnings. --- contrib/sepgsql/label.c | 4 ++-- contrib/sepgsql/relation.c | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..a404cd7 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -8,6 +8,8 @@ * * ------------------------------------------------------------------------- */ +#include <selinux/label.h> + #include "postgres.h" #include "access/heapam.h" @@ -37,8 +39,6 @@ #include "sepgsql.h" -#include <selinux/label.h> - /* * Saved hook entries (if stacked) */ diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..fd6fe8b 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -300,8 +300,10 @@ sepgsql_relation_post_create(Oid relOid) tclass = SEPG_CLASS_DB_VIEW; break; case RELKIND_INDEX: - /* deal with indexes specially; no need for tclass */ + /* other indexes are handled specially below; set tclass to -1 to + * silence compiler warning */ sepgsql_index_modify(relOid); + tclass = -1; goto out; default: /* ignore other relkinds */ @@ -432,7 +434,9 @@ sepgsql_relation_drop(Oid relOid) /* ignore indexes on toast tables */ if (get_rel_namespace(relOid) == PG_TOAST_NAMESPACE) return; - /* other indexes are handled specially below; no need for tclass */ + /* other indexes are handled specially below; set tclass to -1 to + * silence compiler warning */ + tclass = -1; break; default: /* ignore other relkinds */ -- 2.7.4
0002-Add-partitioned-table-support-to-sepgsql.patch (text/x-patch, 4.6K) download From b3a44aa37b5724ea88fb0d1110ba18be6618e283 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Wed, 29 Mar 2017 14:59:37 +0000 Subject: [PATCH 2/2] Add partitioned table support to sepgsql Account for RELKIND_PARTITIONED_RELATIONS in sepgsql and treat the objects like regular relations. This allows for proper create/alter/drop hook behavior for partitioned tables. --- contrib/sepgsql/label.c | 3 ++- contrib/sepgsql/relation.c | 33 +++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index a404cd7..88a04a4 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -779,7 +779,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); - if (relForm->relkind == RELKIND_RELATION) + if (relForm->relkind == RELKIND_RELATION || + relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index fd6fe8b..f6c56c4 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -54,12 +54,14 @@ sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum) ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind; /* * Only attributes within regular relation have individual security * labels. */ - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -135,8 +137,10 @@ sepgsql_attribute_drop(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -167,8 +171,11 @@ sepgsql_attribute_relabel(Oid relOid, AttrNumber attnum, { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); @@ -209,8 +216,11 @@ sepgsql_attribute_setattr(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; + + relkind = get_rel_relkind(relOid); - if (get_rel_relkind(relOid) != RELKIND_RELATION) + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -290,6 +300,7 @@ sepgsql_relation_post_create(Oid relOid) switch (classForm->relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -335,7 +346,8 @@ sepgsql_relation_post_create(Oid relOid) true); /* - * Assign the default security label on the new relation + * Assign the default security label on the new relation or partitioned + * table. */ object.classId = RelationRelationId; object.objectId = relOid; @@ -343,10 +355,10 @@ sepgsql_relation_post_create(Oid relOid) SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* - * We also assigns a default security label on columns of the new regular - * tables. + * We also assign a default security label on columns of a new table. */ - if (classForm->relkind == RELKIND_RELATION) + if (classForm->relkind == RELKIND_RELATION || + classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; @@ -421,6 +433,7 @@ sepgsql_relation_drop(Oid relOid) relkind = get_rel_relkind(relOid); switch (relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -483,7 +496,7 @@ sepgsql_relation_drop(Oid relOid) /* * check db_column:{drop} permission */ - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; @@ -529,7 +542,7 @@ sepgsql_relation_relabel(Oid relOid, const char *seclabel) uint16_t tclass = 0; relkind = get_rel_relkind(relOid); - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; -- 2.7.4
^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-01 00:23           ` Robert Haas <robertmhaas@gmail.com>
  2017-04-03 15:38             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 14:30             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  1 sibling, 3 replies; 61+ messages in thread

From: Robert Haas @ 2017-04-01 00:23 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Fri, Mar 31, 2017 at 2:14 PM, Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
> Attached you will find two patches, which were rebased on master as of
> 156d388 (applied with `git am --revert [patch file]`). The first gets
> rid of some pesky compiler warnings and the second implements the
> sepgsql handling of partitioned tables.

0001 has the problem that we have a firm rule against putting any
#includes whatsoever before "postgres.h".  This stdbool issue has come
up before, though, and I fear we're going to need to do something
about it.

0002 looks extremely straightforward, but I wonder if we could get one
of the people on this list who knows about sepgsql to have a look?
(Stephen Frost, Joe Conway, KaiGai Kohei...)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-04-03 15:38             ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2 siblings, 0 replies; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-03 15:38 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Fri, Mar 31, 2017 at 8:23 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Fri, Mar 31, 2017 at 2:14 PM, Mike Palmiotto
> <mike.palmiotto@crunchydata.com> wrote:
>> Attached you will find two patches, which were rebased on master as of
>> 156d388 (applied with `git am --revert [patch file]`). The first gets
>> rid of some pesky compiler warnings and the second implements the
>> sepgsql handling of partitioned tables.
>
> 0001 has the problem that we have a firm rule against putting any
> #includes whatsoever before "postgres.h".  This stdbool issue has come
> up before, though, and I fear we're going to need to do something
> about it.

Yeah, I recall this rule. The only things I can really think of to
solve the problem are:
1) #define _STDBOOL_H in postgres's c.h once bool and the like have
been defined, so we can avoid re-definition.
2) Enforce that any code utilizing the stdbool header manage the
re-definition with some combination of #undef/#define/#typedef and
document the issue somewhere.

I'd be more inclined to believe 2) is the correct solution, since 1)
is more of a hack than anything.

Thoughts?

>
> 0002 looks extremely straightforward, but I wonder if we could get one
> of the people on this list who knows about sepgsql to have a look?
> (Stephen Frost, Joe Conway, KaiGai Kohei...)

I welcome any and all feedback.

Thanks,
-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-04-03 16:02             ` Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-03 16:02 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 03/31/2017 05:23 PM, Robert Haas wrote:
> On Fri, Mar 31, 2017 at 2:14 PM, Mike Palmiotto
> <mike.palmiotto@crunchydata.com> wrote:
>> Attached you will find two patches, which were rebased on master as of
>> 156d388 (applied with `git am --revert [patch file]`). The first gets
>> rid of some pesky compiler warnings and the second implements the
>> sepgsql handling of partitioned tables.
> 
> 0001 has the problem that we have a firm rule against putting any
> #includes whatsoever before "postgres.h".  This stdbool issue has come
> up before, though, and I fear we're going to need to do something
> about it.
> 
> 0002 looks extremely straightforward, but I wonder if we could get one
> of the people on this list who knows about sepgsql to have a look?
> (Stephen Frost, Joe Conway, KaiGai Kohei...)

Will have a look later today.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-04 13:45               ` Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Robert Haas @ 2017-04-04 13:45 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Mon, Apr 3, 2017 at 12:02 PM, Joe Conway <mail@joeconway.com> wrote:
>> 0002 looks extremely straightforward, but I wonder if we could get one
>> of the people on this list who knows about sepgsql to have a look?
>> (Stephen Frost, Joe Conway, KaiGai Kohei...)
>
> Will have a look later today.

I think it is now tomorrow, unless your time zone is someplace very
far away.  :-)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-04-04 14:19                 ` Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-04 14:19 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/04/2017 06:45 AM, Robert Haas wrote:
> On Mon, Apr 3, 2017 at 12:02 PM, Joe Conway <mail@joeconway.com> wrote:
>>> 0002 looks extremely straightforward, but I wonder if we could get one
>>> of the people on this list who knows about sepgsql to have a look?
>>> (Stephen Frost, Joe Conway, KaiGai Kohei...)
>>
>> Will have a look later today.
> 
> I think it is now tomorrow, unless your time zone is someplace very
> far away.  :-)

OBE -- I have scheduled time in 30 minutes from now, after I have gotten
my first cup of coffee ;-)

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-04 16:55                   ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-04 16:55 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Tue, Apr 4, 2017 at 10:19 AM, Joe Conway <mail@joeconway.com> wrote:
> On 04/04/2017 06:45 AM, Robert Haas wrote:
>> On Mon, Apr 3, 2017 at 12:02 PM, Joe Conway <mail@joeconway.com> wrote:
>>>> 0002 looks extremely straightforward, but I wonder if we could get one
>>>> of the people on this list who knows about sepgsql to have a look?
>>>> (Stephen Frost, Joe Conway, KaiGai Kohei...)
>>>
>>> Will have a look later today.
>>
>> I think it is now tomorrow, unless your time zone is someplace very
>> far away.  :-)
>
> OBE -- I have scheduled time in 30 minutes from now, after I have gotten
> my first cup of coffee ;-)

After some discussion off-list, I've rebased and udpated the patches.
Please see attached for further review.

Thanks,
-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

0002-Add-partitioned-table-support-to-sepgsql.patch (text/x-patch, 4.6K) download From be692f8cc94d74033494d140c310e932c705e785 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Wed, 29 Mar 2017 14:59:37 +0000 Subject: [PATCH 2/2] Add partitioned table support to sepgsql Account for RELKIND_PARTITIONED_RELATIONS in sepgsql and treat the objects like regular relations. This allows for proper object_access hook behavior for partitioned tables. --- contrib/sepgsql/label.c | 3 ++- contrib/sepgsql/relation.c | 33 +++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 8a72503..c66581a 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -787,7 +787,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); - if (relForm->relkind == RELKIND_RELATION) + if (relForm->relkind == RELKIND_RELATION || + relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index 4dc48a0..4fcebc1 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -54,12 +54,14 @@ sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum) ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind; /* * Only attributes within regular relation have individual security * labels. */ - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -135,8 +137,10 @@ sepgsql_attribute_drop(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -167,8 +171,11 @@ sepgsql_attribute_relabel(Oid relOid, AttrNumber attnum, { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); @@ -209,8 +216,11 @@ sepgsql_attribute_setattr(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; + + relkind = get_rel_relkind(relOid); - if (get_rel_relkind(relOid) != RELKIND_RELATION) + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -290,6 +300,7 @@ sepgsql_relation_post_create(Oid relOid) switch (classForm->relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -336,7 +347,8 @@ sepgsql_relation_post_create(Oid relOid) true); /* - * Assign the default security label on the new relation + * Assign the default security label on the new relation or partitioned + * table. */ object.classId = RelationRelationId; object.objectId = relOid; @@ -344,10 +356,10 @@ sepgsql_relation_post_create(Oid relOid) SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* - * We also assigns a default security label on columns of the new regular - * tables. + * We also assign a default security label on columns of a new table. */ - if (classForm->relkind == RELKIND_RELATION) + if (classForm->relkind == RELKIND_RELATION || + classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; @@ -422,6 +434,7 @@ sepgsql_relation_drop(Oid relOid) relkind = get_rel_relkind(relOid); switch (relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -485,7 +498,7 @@ sepgsql_relation_drop(Oid relOid) /* * check db_column:{drop} permission */ - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; @@ -531,7 +544,7 @@ sepgsql_relation_relabel(Oid relOid, const char *seclabel) uint16_t tclass = 0; relkind = get_rel_relkind(relOid); - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; -- 1.8.3.1
0001-Silence-some-sepgsql-compiler-warnings.patch (text/x-patch, 2.7K) download From e918187f565eac1aeed2c0e8fb32893ef3bb2143 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Tue, 28 Mar 2017 16:44:54 +0000 Subject: [PATCH 1/2] Silence some sepgsql compiler warnings selinux/label.h includes stdbool.h, which redefines the bool type and results in a warning: assignment from incompatible pointer type for sepgsql_fmgr_hook. Make sure we clean up the bool definition after label.h is included. Additionally, sepgsql throws compiler warnings due to possibly uninitialized tclass in code paths for indexes. Set tclass to a PG_UINT16_MAX (undefined) to silence these warnings. --- contrib/sepgsql/label.c | 12 ++++++++++-- contrib/sepgsql/relation.c | 10 ++++++++-- contrib/sepgsql/sepgsql.h | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..8a72503 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -10,6 +10,16 @@ */ #include "postgres.h" +#include <selinux/label.h> + +/* + * Fix for stdbool.h re-definition of bool type + */ +#ifdef bool +#undef bool +typedef char bool; +#endif + #include "access/heapam.h" #include "access/htup_details.h" #include "access/genam.h" @@ -37,8 +47,6 @@ #include "sepgsql.h" -#include <selinux/label.h> - /* * Saved hook entries (if stacked) */ diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..4dc48a0 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -300,8 +300,11 @@ sepgsql_relation_post_create(Oid relOid) tclass = SEPG_CLASS_DB_VIEW; break; case RELKIND_INDEX: - /* deal with indexes specially; no need for tclass */ + /* other indexes are handled specially below; set tclass to + * "undefined" to silence compiler warning + */ sepgsql_index_modify(relOid); + tclass = SEPG_CLASS_UNDEFINED; goto out; default: /* ignore other relkinds */ @@ -432,7 +435,10 @@ sepgsql_relation_drop(Oid relOid) /* ignore indexes on toast tables */ if (get_rel_namespace(relOid) == PG_TOAST_NAMESPACE) return; - /* other indexes are handled specially below; no need for tclass */ + /* other indexes are handled specially below; set tclass to + * "undefined" to silence compiler warning + */ + tclass = SEPG_CLASS_UNDEFINED; break; default: /* ignore other relkinds */ diff --git a/contrib/sepgsql/sepgsql.h b/contrib/sepgsql/sepgsql.h index 9d245c2..ec6fdd8 100644 --- a/contrib/sepgsql/sepgsql.h +++ b/contrib/sepgsql/sepgsql.h @@ -52,7 +52,7 @@ #define SEPG_CLASS_DB_LANGUAGE 16 #define SEPG_CLASS_DB_VIEW 17 #define SEPG_CLASS_MAX 18 - +#define SEPG_CLASS_UNDEFINED PG_UINT16_MAX /* * Internally used code of access vectors */ -- 1.8.3.1
^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-04 17:02                     ` Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-04 17:02 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/04/2017 09:55 AM, Mike Palmiotto wrote:
> On Tue, Apr 4, 2017 at 10:19 AM, Joe Conway <mail@joeconway.com> wrote:
>> On 04/04/2017 06:45 AM, Robert Haas wrote:
>>> On Mon, Apr 3, 2017 at 12:02 PM, Joe Conway <mail@joeconway.com> wrote:
>>>>> 0002 looks extremely straightforward, but I wonder if we could get one
>>>>> of the people on this list who knows about sepgsql to have a look?
>>>>> (Stephen Frost, Joe Conway, KaiGai Kohei...)
>>>>
>>>> Will have a look later today.
>>>
>>> I think it is now tomorrow, unless your time zone is someplace very
>>> far away.  :-)
>>
>> OBE -- I have scheduled time in 30 minutes from now, after I have gotten
>> my first cup of coffee ;-)
> 
> After some discussion off-list, I've rebased and udpated the patches.
> Please see attached for further review.

Thanks -- will have another look and test on a machine with selinux
setup. Robert, did you want me to take responsibility to commit on this
or just provide review/feedback?

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-04 22:56                       ` Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-04 22:56 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/04/2017 10:02 AM, Joe Conway wrote:
> On 04/04/2017 09:55 AM, Mike Palmiotto wrote:
>> After some discussion off-list, I've rebased and udpated the patches.
>> Please see attached for further review.
> 
> Thanks -- will have another look and test on a machine with selinux
> setup. Robert, did you want me to take responsibility to commit on this
> or just provide review/feedback?

I did some editorializing on these.

In particular I did not like the approach to fixing "warning: ‘tclass’
may be used uninitialized" and ended up just doing it the same as was
done elsewhere in relation.c already (set tclass = 0 in the variable
declaration). Along the way I also changed one instance of tclass from
uint16 to uint16_t for the sake of consistency.

Interestingly we figured out that the warning was present with -Og, but
not present with -O0, -O2, or -O3.

If you want to test, apply 0001a and 0001b before 0002.

Any objections?

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments: download all (4 files, .tar.gz)

0001a-silence-sepgsql-compiler-warning-bool.patch (text/x-diff, 701B) download diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..320c098 100644 *** a/contrib/sepgsql/label.c --- b/contrib/sepgsql/label.c *************** *** 10,15 **** --- 10,25 ---- */ #include "postgres.h" + #include <selinux/label.h> + /* + * selinux/label.h includes stdbool.h, which redefines bool, so + * revert to the postgres definition of bool from c.h + */ + #ifdef bool + #undef bool + typedef char bool; + #endif + #include "access/heapam.h" #include "access/htup_details.h" #include "access/genam.h" *************** *** 37,44 **** #include "sepgsql.h" - #include <selinux/label.h> - /* * Saved hook entries (if stacked) */ --- 47,52 ----
0001b-silence-sepgsql-compiler-warning-uninitialized.patch (text/x-diff, 1014B) download diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..2ea6bfb 100644 *** a/contrib/sepgsql/relation.c --- b/contrib/sepgsql/relation.c *************** sepgsql_relation_post_create(Oid relOid) *** 243,249 **** HeapTuple tuple; Form_pg_class classForm; ObjectAddress object; ! uint16 tclass; char *scontext; /* subject */ char *tcontext; /* schema */ char *rcontext; /* relation */ --- 243,249 ---- HeapTuple tuple; Form_pg_class classForm; ObjectAddress object; ! uint16_t tclass; char *scontext; /* subject */ char *tcontext; /* schema */ char *rcontext; /* relation */ *************** sepgsql_relation_drop(Oid relOid) *** 413,419 **** { ObjectAddress object; char *audit_name; ! uint16_t tclass; char relkind; relkind = get_rel_relkind(relOid); --- 413,419 ---- { ObjectAddress object; char *audit_name; ! uint16_t tclass = 0; char relkind; relkind = get_rel_relkind(relOid);
0002-add-partitioned-table-support-to-sepgsql.patch (text/x-diff, 6.1K) download diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..4dda82a 100644 *** a/contrib/sepgsql/label.c --- b/contrib/sepgsql/label.c *************** exec_object_restorecon(struct selabel_ha *** 779,785 **** case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; --- 779,786 ---- case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION || ! relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..f8689c0 100644 *** a/contrib/sepgsql/relation.c --- b/contrib/sepgsql/relation.c *************** sepgsql_attribute_post_create(Oid relOid *** 54,65 **** ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; /* ! * Only attributes within regular relation have individual security ! * labels. */ ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 54,66 ---- ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind = get_rel_relkind(relOid); /* ! * Only attributes within regular relations or partition relations have ! * individual security labels. */ ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_drop(Oid relOid, AttrN *** 135,142 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 136,144 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_relabel(Oid relOid, At *** 167,174 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); --- 169,177 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); *************** sepgsql_attribute_setattr(Oid relOid, At *** 209,216 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 212,220 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_relation_post_create(Oid relOid) *** 291,296 **** --- 295,301 ---- switch (classForm->relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_post_create(Oid relOid) *** 333,339 **** true); /* ! * Assign the default security label on the new relation */ object.classId = RelationRelationId; object.objectId = relOid; --- 338,345 ---- true); /* ! * Assign the default security label on the new relation or partitioned ! * table. */ object.classId = RelationRelationId; object.objectId = relOid; *************** sepgsql_relation_post_create(Oid relOid) *** 341,350 **** SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assigns a default security label on columns of the new regular ! * tables. */ ! if (classForm->relkind == RELKIND_RELATION) { Relation arel; ScanKeyData akey; --- 347,356 ---- SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assign a default security label on columns of a new table. */ ! if (classForm->relkind == RELKIND_RELATION || ! classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; *************** sepgsql_relation_drop(Oid relOid) *** 414,425 **** ObjectAddress object; char *audit_name; uint16_t tclass = 0; ! char relkind; - relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: --- 420,431 ---- ObjectAddress object; char *audit_name; uint16_t tclass; ! char relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_drop(Oid relOid) *** 479,485 **** /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION) { Form_pg_attribute attForm; CatCList *attrList; --- 485,491 ---- /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; *************** sepgsql_relation_relabel(Oid relOid, con *** 521,531 **** { ObjectAddress object; char *audit_name; ! char relkind; uint16_t tclass = 0; ! relkind = get_rel_relkind(relOid); ! if (relkind == RELKIND_RELATION) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; --- 527,536 ---- { ObjectAddress object; char *audit_name; ! char relkind = get_rel_relkind(relOid); uint16_t tclass = 0; ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE;
signature.asc (application/pgp-signature, 818B) download ^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-05 01:29                         ` Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 61+ messages in thread

From: Robert Haas @ 2017-04-05 01:29 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Tue, Apr 4, 2017 at 6:56 PM, Joe Conway <mail@joeconway.com> wrote:
> On 04/04/2017 10:02 AM, Joe Conway wrote:
>> On 04/04/2017 09:55 AM, Mike Palmiotto wrote:
>>> After some discussion off-list, I've rebased and udpated the patches.
>>> Please see attached for further review.
>>
>> Thanks -- will have another look and test on a machine with selinux
>> setup. Robert, did you want me to take responsibility to commit on this
>> or just provide review/feedback?
>
> I did some editorializing on these.
>
> In particular I did not like the approach to fixing "warning: ‘tclass’
> may be used uninitialized" and ended up just doing it the same as was
> done elsewhere in relation.c already (set tclass = 0 in the variable
> declaration). Along the way I also changed one instance of tclass from
> uint16 to uint16_t for the sake of consistency.
>
> Interestingly we figured out that the warning was present with -Og, but
> not present with -O0, -O2, or -O3.
>
> If you want to test, apply 0001a and 0001b before 0002.
>
> Any objections?

I'm guessing Tom's going to have a strong feeling about whether 0001a
is the right way to address the stdbool issue, but I don't personally
know what the right thing to do is so I will avoid opining on that
topic.

So, nope, no objections here to you committing those.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-04-05 04:58                           ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 05:17                             ` Re: partitioned tables and contrib/sepgsql Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-04-05 07:02                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 13:48                             ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 4 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 04:58 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Apr 4, 2017 at 6:56 PM, Joe Conway <mail@joeconway.com> wrote:
>> Any objections?

> I'm guessing Tom's going to have a strong feeling about whether 0001a
> is the right way to address the stdbool issue,

I will?  [ looks ... ]  Yup, you're right.

I doubt that works at all, TBH.  What I'd expect to happen with a
typical compiler is a complaint about redefinition of typedef bool,
because c.h already declared it and here this fragment is doing
so again.  It'd make sense to me to do

+ #ifdef bool
+ #undef bool
+ #endif

to get rid of the macro definition of bool that stdbool.h is
supposed to provide.  But there should be no reason to declare
our typedef a second time.

Another issue is whether you won't get compiler complaints about
redefinition of the "true" and "false" macros.  But those would
likely only be warnings, not flat-out errors.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 05:17                             ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-04-05 05:20                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  3 siblings, 1 reply; 61+ messages in thread

From: Peter Eisentraut @ 2017-04-05 05:17 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Robert Haas <robertmhaas@gmail.com>; +Cc: Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 4/5/17 00:58, Tom Lane wrote:
> Another issue is whether you won't get compiler complaints about
> redefinition of the "true" and "false" macros.  But those would
> likely only be warnings, not flat-out errors.

The complaint about bool is also just a warning.

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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 05:17                             ` Re: partitioned tables and contrib/sepgsql Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2017-04-05 05:20                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:56                                 ` Re: partitioned tables and contrib/sepgsql Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-04-05 16:14                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 05:20 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 4/5/17 00:58, Tom Lane wrote:
>> Another issue is whether you won't get compiler complaints about
>> redefinition of the "true" and "false" macros.  But those would
>> likely only be warnings, not flat-out errors.

> The complaint about bool is also just a warning.

Really?

$ cat test.c
typedef char bool;
typedef char bool;
$ gcc -c test.c
test.c:2: error: redefinition of typedef 'bool'
test.c:1: note: previous declaration of 'bool' was here

This is with gcc 4.4.7.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 05:17                             ` Re: partitioned tables and contrib/sepgsql Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-04-05 05:20                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 15:56                                 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  1 sibling, 0 replies; 61+ messages in thread

From: Peter Eisentraut @ 2017-04-05 15:56 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 4/5/17 01:20, Tom Lane wrote:
>> The complaint about bool is also just a warning.
> 
> Really?
> 
> $ cat test.c
> typedef char bool;
> typedef char bool;
> $ gcc -c test.c
> test.c:2: error: redefinition of typedef 'bool'
> test.c:1: note: previous declaration of 'bool' was here
> 
> This is with gcc 4.4.7.

But the above is not how the current code looks.

stdbool.h does

#define bool _Bool

c.h does

#ifndef bool
typedef char bool;
#endif

So if you get stdbool.h first, then c.h does nothing.  If you get c.h
first, then the macro from stdbool.h will mask the c.h typedef.

Where this gets really fun is when you include other header files
between, say, postgres.h and selinux/label.h, because then the function
definitions from those header files will be incompatible before and
after the stdbool.h inclusion.  Which indeed currently leads to the
following compilation error:

label.c: In function ‘sepgsql_init_client_label’:
label.c:437:18: error: assignment from incompatible pointer type
[-Werror=incompatible-pointer-types]
  needs_fmgr_hook = sepgsql_needs_fmgr_hook;
                  ^

So I can't reproduce the original complaint, but this is potentially worse.

(The above is on Fedora 25.  You need a fairly new selinux.)

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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 05:17                             ` Re: partitioned tables and contrib/sepgsql Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-04-05 05:20                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 16:14                                 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 16:14 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 4/5/17 01:20, Tom Lane wrote:
>> $ cat test.c
>> typedef char bool;
>> typedef char bool;
>> $ gcc -c test.c
>> test.c:2: error: redefinition of typedef 'bool'
>> test.c:1: note: previous declaration of 'bool' was here

> But the above is not how the current code looks.

No, but it is what the proposed 0001a patch would result in.

The experiments I just did prove that F25's gcc is cheating like mad in
its implementation of "#include <stdbool.h>".  I suspect that it's somehow
turning off the warning that you ought to get about redefining typedef
bool, as well, though I'm very unclear on how.  In any case we don't need
the extra typedef and should leave it out.

> So if you get stdbool.h first, then c.h does nothing.  If you get c.h
> first, then the macro from stdbool.h will mask the c.h typedef.

Right, and *either* of those is disastrous if sizeof(_Bool) isn't 1.

> Where this gets really fun is when you include other header files
> between, say, postgres.h and selinux/label.h, because then the function
> definitions from those header files will be incompatible before and
> after the stdbool.h inclusion.  Which indeed currently leads to the
> following compilation error:

The compilation complaint comes from the fact that we have

static bool
sepgsql_needs_fmgr_hook(Oid functionId)

appearing after the inclusion of <stdbool.h>, causing it to mean
something else than what a Postgres programmer would expect.
The other headers aren't at issue really.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 07:02                             ` Andres Freund <andres@anarazel.de>
  2017-04-05 13:43                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  3 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-05 07:02 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 2017-04-05 00:58:07 -0400, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > On Tue, Apr 4, 2017 at 6:56 PM, Joe Conway <mail@joeconway.com> wrote:
> >> Any objections?
> 
> > I'm guessing Tom's going to have a strong feeling about whether 0001a
> > is the right way to address the stdbool issue,
> 
> I will?  [ looks ... ]  Yup, you're right.
> 
> I doubt that works at all, TBH.  What I'd expect to happen with a
> typical compiler is a complaint about redefinition of typedef bool,
> because c.h already declared it and here this fragment is doing
> so again.  It'd make sense to me to do
> 
> + #ifdef bool
> + #undef bool
> + #endif
> 
> to get rid of the macro definition of bool that stdbool.h is
> supposed to provide.  But there should be no reason to declare
> our typedef a second time.

> Another issue is whether you won't get compiler complaints about
> redefinition of the "true" and "false" macros.  But those would
> likely only be warnings, not flat-out errors.

I argued before that we should migrate to stdbool.h by default, because
it's only going to get more common.  We already do so in a way for c++
compilers...

- Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 07:02                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-05 13:43                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:28                                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 61+ messages in thread

From: Tom Lane @ 2017-04-05 13:43 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Andres Freund <andres@anarazel.de> writes:
> I argued before that we should migrate to stdbool.h by default, because
> it's only going to get more common.  We already do so in a way for c++
> compilers...

Yeah, I was just thinking about that.  The core problem though is that
we need the "bool" fields in the system catalog structs (or anyplace
else that it represents an on-disk bool datum) to be understood as
being 1 byte wide.  I do not think we can assume that that's true of
every compiler's _Bool type.  So we'd need some workaround for that.
There are probably other places such as isnull arrays where it'd be
wise to force the width to be 1 byte.

In any case, that's a research project that's not getting done for v10.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 07:02                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 13:43                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 14:28                                 ` Andres Freund <andres@anarazel.de>
  2017-04-05 14:45                                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-05 14:28 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 2017-04-05 09:43:53 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > I argued before that we should migrate to stdbool.h by default, because
> > it's only going to get more common.  We already do so in a way for c++
> > compilers...
> 
> Yeah, I was just thinking about that.  The core problem though is that
> we need the "bool" fields in the system catalog structs (or anyplace
> else that it represents an on-disk bool datum) to be understood as
> being 1 byte wide. I do not think we can assume that that's true of
> every compiler's _Bool type.  So we'd need some workaround for that.
> There are probably other places such as isnull arrays where it'd be
> wise to force the width to be 1 byte.

I wonder if there's any compiler that has _Bool/stdbool.h where it's not
1 byte sized. It's definitely not guaranteed by the standard.

Having a seperate booldatum type or such shouldn't be too bad, either
way.


> In any case, that's a research project that's not getting done for v10.

Agreed.


- Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 07:02                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 13:43                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:28                                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-05 14:45                                   ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:52                                     ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 61+ messages in thread

From: Tom Lane @ 2017-04-05 14:45 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Andres Freund <andres@anarazel.de> writes:
> On 2017-04-05 09:43:53 -0400, Tom Lane wrote:
>> Yeah, I was just thinking about that.  The core problem though is that
>> we need the "bool" fields in the system catalog structs (or anyplace
>> else that it represents an on-disk bool datum) to be understood as
>> being 1 byte wide. I do not think we can assume that that's true of
>> every compiler's _Bool type.  So we'd need some workaround for that.
>> There are probably other places such as isnull arrays where it'd be
>> wise to force the width to be 1 byte.

> I wonder if there's any compiler that has _Bool/stdbool.h where it's not
> 1 byte sized. It's definitely not guaranteed by the standard.

Hm.  I'd supposed that it'd be pretty common to make _Bool be int-sized.

If it is char-sized almost everywhere, we could create a policy of
using stdbool.h unless configure sees that _Bool is not char-sized.
OTOH, that doesn't improve our existing situation that we have
platform-dependent semantics around "bool" (eg, what happens when
a non-char-sized value is assigned).  It would just change which
one is the majority case, and not in a very safe direction :-(

>> In any case, that's a research project that's not getting done for v10.

> Agreed.

Yeah, it's off-topic for right now.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 07:02                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 13:43                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:28                                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 14:45                                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 14:52                                     ` Andres Freund <andres@anarazel.de>
  2017-04-05 15:25                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-05 14:52 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 2017-04-05 10:45:06 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2017-04-05 09:43:53 -0400, Tom Lane wrote:
> >> Yeah, I was just thinking about that.  The core problem though is that
> >> we need the "bool" fields in the system catalog structs (or anyplace
> >> else that it represents an on-disk bool datum) to be understood as
> >> being 1 byte wide. I do not think we can assume that that's true of
> >> every compiler's _Bool type.  So we'd need some workaround for that.
> >> There are probably other places such as isnull arrays where it'd be
> >> wise to force the width to be 1 byte.
> 
> > I wonder if there's any compiler that has _Bool/stdbool.h where it's not
> > 1 byte sized. It's definitely not guaranteed by the standard.
> 
> Hm.  I'd supposed that it'd be pretty common to make _Bool be int-sized.

I think nearly all x86 compilers use 1byte, but I assume there's some
architectures where that'd be expensive.


> If it is char-sized almost everywhere, we could create a policy of
> using stdbool.h unless configure sees that _Bool is not char-sized.
> OTOH, that doesn't improve our existing situation that we have
> platform-dependent semantics around "bool" (eg, what happens when
> a non-char-sized value is assigned).  It would just change which
> one is the majority case, and not in a very safe direction :-(

Yea, no, that doesn't like fun :(.


Might make sense to temporarily add a configure test checking for
_Bool/stdbool size, so we have some idea what we're talking about.


Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 07:02                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 13:43                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:28                                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 14:45                                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:52                                     ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-05 15:25                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 15:25 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Robert Haas <robertmhaas@gmail.com>; Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Andres Freund <andres@anarazel.de> writes:
> On 2017-04-05 10:45:06 -0400, Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>>> I wonder if there's any compiler that has _Bool/stdbool.h where it's not
>>> 1 byte sized. It's definitely not guaranteed by the standard.

>> Hm.  I'd supposed that it'd be pretty common to make _Bool be int-sized.

> I think nearly all x86 compilers use 1byte, but I assume there's some
> architectures where that'd be expensive.

[ pokes around... ]  prairiedog's gcc (Apple PPC) thinks sizeof(_Bool)
is 4.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 13:48                             ` Robert Haas <robertmhaas@gmail.com>
  3 siblings, 0 replies; 61+ messages in thread

From: Robert Haas @ 2017-04-05 13:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Joe Conway <mail@joeconway.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Wed, Apr 5, 2017 at 12:58 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Tue, Apr 4, 2017 at 6:56 PM, Joe Conway <mail@joeconway.com> wrote:
>>> Any objections?
>
>> I'm guessing Tom's going to have a strong feeling about whether 0001a
>> is the right way to address the stdbool issue,
>
> I will?  [ looks ... ]  Yup, you're right.

It happens occasionally.  :-)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 15:31                             ` Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  3 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-05 15:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Robert Haas <robertmhaas@gmail.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/04/2017 09:58 PM, Tom Lane wrote:
> I doubt that works at all, TBH.  What I'd expect to happen with a
> typical compiler is a complaint about redefinition of typedef bool,
> because c.h already declared it and here this fragment is doing
> so again.  It'd make sense to me to do
> 
> + #ifdef bool
> + #undef bool
> + #endif
> 
> to get rid of the macro definition of bool that stdbool.h is
> supposed to provide.  But there should be no reason to declare
> our typedef a second time.

makes sense

> Another issue is whether you won't get compiler complaints about
> redefinition of the "true" and "false" macros.  But those would
> likely only be warnings, not flat-out errors.

I have not been able to generate warnings or errors around "true" and
"false".

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-05 16:04                               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 16:06                                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 16:53                                 ` Re: partitioned tables and contrib/sepgsql Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 3 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 16:04 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Joe Conway <mail@joeconway.com> writes:
> On 04/04/2017 09:58 PM, Tom Lane wrote:
>> Another issue is whether you won't get compiler complaints about
>> redefinition of the "true" and "false" macros.  But those would
>> likely only be warnings, not flat-out errors.

> I have not been able to generate warnings or errors around "true" and
> "false".

Interesting.  Poking at it on a Fedora 25 machine, I also see a
bool-type-related warning in sepgsql/label.c, but nothing around macro
redefinitions.  In particular, I find that

#include "postgres.h"

#include <stdbool.h>

is completely silent.  On the other hand,

#include "postgres.h"

#define bool    _Bool
#define true    1
#define false   0

generates the warnings I expected about "true" and "false" being
redefined.  Which is damn odd, because I copied-and-pasted those
lines out of
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stdbool.h

Conclusion: Fedora's gcc is playing fast and loose somehow with the
command "#include <stdbool.h>"; that does not include the file
you'd think it does, it does something magic inside the compiler.
The magic evidently includes not complaining about duplicate macro
definitions for true and false.

Anyway, I'd recommend that we do something like

 #include <selinux/label.h>
+
+/*
+ * <selinux/label.h> includes <stdbool.h>, which creates an incompatible
+ * #define for bool.  Get rid of that so we can use our own typedef.
+ * (For obscure reasons, the "true" and "false" macros don't cause issues.)
+ */
+ #undef bool

and call it good.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 16:06                                 ` Andres Freund <andres@anarazel.de>
  2017-04-05 16:26                                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-05 16:06 UTC (permalink / raw)
  To: pgsql-hackers; Tom Lane <tgl@sss.pgh.pa.us>; Joe Conway <mail@joeconway.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers



On April 5, 2017 9:04:00 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>Joe Conway <mail@joeconway.com> writes:
>> On 04/04/2017 09:58 PM, Tom Lane wrote:
>>> Another issue is whether you won't get compiler complaints about
>>> redefinition of the "true" and "false" macros.  But those would
>>> likely only be warnings, not flat-out errors.
>
>> I have not been able to generate warnings or errors around "true" and
>> "false".
>
>Interesting.  Poking at it on a Fedora 25 machine, I also see a
>bool-type-related warning in sepgsql/label.c, but nothing around macro
>redefinitions.  In particular, I find that
>
>#include "postgres.h"
>
>#include <stdbool.h>
>
>is completely silent.  On the other hand,
>
>#include "postgres.h"
>
>#define bool    _Bool
>#define true    1
>#define false   0
>
>generates the warnings I expected about "true" and "false" being
>redefined.  Which is damn odd, because I copied-and-pasted those
>lines out of
>/usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stdbool.h
>
>Conclusion: Fedora's gcc is playing fast and loose somehow with the
>command "#include <stdbool.h>"; that does not include the file
>you'd think it does, it does something magic inside the compiler.
>The magic evidently includes not complaining about duplicate macro
>definitions for true and false.
>
>Anyway, I'd recommend that we do something like
>
> #include <selinux/label.h>
>+
>+/*
>+ * <selinux/label.h> includes <stdbool.h>, which creates an
>incompatible
>+ * #define for bool.  Get rid of that so we can use our own typedef.
>+ * (For obscure reasons, the "true" and "false" macros don't cause
>issues.)
>+ */

GCC generally doesn't warn about macro redefinitions, if both definitions are equivalent.  IIRC we have some examples of that in the tree.  There's a flag to warn regardless.

Andres
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 16:06                                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-05 16:26                                   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 16:26 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-hackers; Joe Conway <mail@joeconway.com>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>

Andres Freund <andres@anarazel.de> writes:
> GCC generally doesn't warn about macro redefinitions, if both
> definitions are equivalent.

But they're *not* equivalent.  c.h has

#define true	((bool) 1)

whereas so far as I can see the <stdbool.h> definition is just

#define true	1

And if you put those two definitions together you will get a warning.
The lack of one with c.h + <stdbool.h> means somebody is cheating.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 16:53                                 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2 siblings, 0 replies; 61+ messages in thread

From: Peter Eisentraut @ 2017-04-05 16:53 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Joe Conway <mail@joeconway.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 4/5/17 12:04, Tom Lane wrote:
> Conclusion: Fedora's gcc is playing fast and loose somehow with the
> command "#include <stdbool.h>"; that does not include the file
> you'd think it does, it does something magic inside the compiler.
> The magic evidently includes not complaining about duplicate macro
> definitions for true and false.

Perhaps -Wsystem-headers would change the outcome in your case.

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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 17:19                                 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2 siblings, 1 reply; 61+ messages in thread

From: Tom Lane @ 2017-04-05 17:19 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Joe Conway <mail@joeconway.com>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 4/5/17 12:04, Tom Lane wrote:
>> Conclusion: Fedora's gcc is playing fast and loose somehow with the
>> command "#include <stdbool.h>"; that does not include the file
>> you'd think it does, it does something magic inside the compiler.
>> The magic evidently includes not complaining about duplicate macro
>> definitions for true and false.

> Perhaps -Wsystem-headers would change the outcome in your case.

Hah, you're right: with that,

In file included from /usr/include/selinux/label.h:9:0,
                 from label.c:40:
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stdbool.h:34:0: warning: "true" redefined
 #define true 1
 
In file included from ../../src/include/postgres.h:47:0,
                 from label.c:11:
../../src/include/c.h:206:0: note: this is the location of the previous definition
 #define true ((bool) 1)

and likewise for "false".  So that mystery is explained.

I stand by my previous patch suggestion, except that we can replace
the parenthetical comment with something like "(We don't care if
<stdbool.h> redefines "true"/"false"; those are close enough.)".

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 17:22                                   ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-05 17:22 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Joe Conway <mail@joeconway.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Wed, Apr 5, 2017 at 1:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> On 4/5/17 12:04, Tom Lane wrote:
>>> Conclusion: Fedora's gcc is playing fast and loose somehow with the
>>> command "#include <stdbool.h>"; that does not include the file
>>> you'd think it does, it does something magic inside the compiler.
>>> The magic evidently includes not complaining about duplicate macro
>>> definitions for true and false.
>
>> Perhaps -Wsystem-headers would change the outcome in your case.
>
> Hah, you're right: with that,
>
> In file included from /usr/include/selinux/label.h:9:0,
>                  from label.c:40:
> /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stdbool.h:34:0: warning: "true" redefined
>  #define true 1
>
> In file included from ../../src/include/postgres.h:47:0,
>                  from label.c:11:
> ../../src/include/c.h:206:0: note: this is the location of the previous definition
>  #define true ((bool) 1)
>
> and likewise for "false".  So that mystery is explained.
>
> I stand by my previous patch suggestion, except that we can replace
> the parenthetical comment with something like "(We don't care if
> <stdbool.h> redefines "true"/"false"; those are close enough.)".
>

Sounds good. Updated patchset will include that verbiage, along with
some regression tests for partitioned tables.

Thanks,

-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-05 21:29                                     ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:08                                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-05 21:29 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Joe Conway <mail@joeconway.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Wed, Apr 5, 2017 at 1:22 PM, Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
> On Wed, Apr 5, 2017 at 1:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>>> On 4/5/17 12:04, Tom Lane wrote:
>>>> Conclusion: Fedora's gcc is playing fast and loose somehow with the
>>>> command "#include <stdbool.h>"; that does not include the file
>>>> you'd think it does, it does something magic inside the compiler.
>>>> The magic evidently includes not complaining about duplicate macro
>>>> definitions for true and false.
>>
>>> Perhaps -Wsystem-headers would change the outcome in your case.
>>
>> Hah, you're right: with that,
>>
>> In file included from /usr/include/selinux/label.h:9:0,
>>                  from label.c:40:
>> /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stdbool.h:34:0: warning: "true" redefined
>>  #define true 1
>>
>> In file included from ../../src/include/postgres.h:47:0,
>>                  from label.c:11:
>> ../../src/include/c.h:206:0: note: this is the location of the previous definition
>>  #define true ((bool) 1)
>>
>> and likewise for "false".  So that mystery is explained.
>>
>> I stand by my previous patch suggestion, except that we can replace
>> the parenthetical comment with something like "(We don't care if
>> <stdbool.h> redefines "true"/"false"; those are close enough.)".
>>
>
> Sounds good. Updated patchset will include that verbiage, along with
> some regression tests for partitioned tables.

Looks like the label regression test is failing even without these changes.

Weirdly enough, this only happens in one place:

 84 SELECT objtype, objname, label FROM pg_seclabels
 85     WHERE provider = 'selinux' AND objtype = 'column' AND (objname
like 't3.%' OR objname like 't4.%');

I haven't figured out why this may be (yet), but it seems like we
shouldn't assume the order of output from a SELECT. As I understand
it, the order of the output is subject to change with changes to the
planner/configuration.

I'm going to hold the partition table regression changes for a
separate patch and include some ORDER BY fixes. Will post tomorrow

In the meantime, attached are the latest and greatest patches.

Thanks,
-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (3 files, .tar.gz)

0003-Add-partitioned-table-support-to-sepgsql.patch (text/x-patch, 4.3K) download From 50969159f0fd7c93a15bfb7b9046512399d0b099 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Wed, 29 Mar 2017 14:59:37 +0000 Subject: [PATCH 3/3] Add partitioned table support to sepgsql Account for RELKIND_PARTITIONED_RELATIONS in sepgsql and treat the objects like regular relations. This allows for proper object_access hook behavior for partitioned tables. --- contrib/sepgsql/label.c | 3 ++- contrib/sepgsql/relation.c | 30 +++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index f7d79ab..1a1ec57 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -789,7 +789,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); - if (relForm->relkind == RELKIND_RELATION) + if (relForm->relkind == RELKIND_RELATION || + relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index b794abe..0d8905c 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -54,12 +54,14 @@ sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum) ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind; /* * Only attributes within regular relation have individual security * labels. */ - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -135,8 +137,10 @@ sepgsql_attribute_drop(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -167,8 +171,11 @@ sepgsql_attribute_relabel(Oid relOid, AttrNumber attnum, { ObjectAddress object; char *audit_name; + char relkind; - if (get_rel_relkind(relOid) != RELKIND_RELATION) + relkind = get_rel_relkind(relOid); + + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); @@ -209,8 +216,11 @@ sepgsql_attribute_setattr(Oid relOid, AttrNumber attnum) { ObjectAddress object; char *audit_name; + char relkind; + + relkind = get_rel_relkind(relOid); - if (get_rel_relkind(relOid) != RELKIND_RELATION) + if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* @@ -290,6 +300,7 @@ sepgsql_relation_post_create(Oid relOid) switch (classForm->relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -341,10 +352,10 @@ sepgsql_relation_post_create(Oid relOid) SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* - * We also assigns a default security label on columns of the new regular - * tables. + * We also assign a default security label on columns of a new table. */ - if (classForm->relkind == RELKIND_RELATION) + if (classForm->relkind == RELKIND_RELATION || + classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; @@ -419,6 +430,7 @@ sepgsql_relation_drop(Oid relOid) relkind = get_rel_relkind(relOid); switch (relkind) { + case RELKIND_PARTITIONED_TABLE: case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; @@ -479,7 +491,7 @@ sepgsql_relation_drop(Oid relOid) /* * check db_column:{drop} permission */ - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; @@ -525,7 +537,7 @@ sepgsql_relation_relabel(Oid relOid, const char *seclabel) uint16_t tclass = 0; relkind = get_rel_relkind(relOid); - if (relkind == RELKIND_RELATION) + if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; -- 1.8.3.1
0001-Deal-with-stdbool-re-definition-of-bool.patch (text/x-patch, 1.3K) download From b54a3ee6a52ea6766b958372827aad4650859ccd Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Wed, 5 Apr 2017 14:27:01 +0000 Subject: [PATCH 1/3] Deal with stdbool re-definition of bool selinux/label.h includes stdbool.h, which redefines the bool type and results in a warning: assignment from incompatible pointer type for sepgsql_fmgr_hook. Make sure we clean up the bool definition after label.h is included. --- contrib/sepgsql/label.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..f7d79ab 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -10,6 +10,18 @@ */ #include "postgres.h" +#include <selinux/label.h> + +/* + * selinux/label.h includes stdbool.h, which #defines bool. This #define + * obscures the postgres definition of bool from c.h. #undef here to keep the + * postgres definition. This is not necessary for true/false re-definitions. + * Those are close enough in stdbool.h. + */ +#ifdef bool +#undef bool +#endif + #include "access/heapam.h" #include "access/htup_details.h" #include "access/genam.h" @@ -37,8 +49,6 @@ #include "sepgsql.h" -#include <selinux/label.h> - /* * Saved hook entries (if stacked) */ -- 1.8.3.1
0002-Silence-maybe-uninitialized-sepgsql-warnings.patch (text/x-patch, 1.3K) download From 207e8180e140efd5f93a3d52332d7b718a09bf34 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Wed, 5 Apr 2017 14:31:25 +0000 Subject: [PATCH 2/3] Silence "maybe uninitialized" sepgsql warnings sepgsql throws compiler warnings due to possibly uninitialized tclass in code paths for indexes when compiling with -Og. Initialize tclass to 0 to silence these warnings. --- contrib/sepgsql/relation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..b794abe 100644 --- a/contrib/sepgsql/relation.c +++ b/contrib/sepgsql/relation.c @@ -243,7 +243,7 @@ sepgsql_relation_post_create(Oid relOid) HeapTuple tuple; Form_pg_class classForm; ObjectAddress object; - uint16 tclass; + uint16_t tclass = 0; char *scontext; /* subject */ char *tcontext; /* schema */ char *rcontext; /* relation */ @@ -413,7 +413,7 @@ sepgsql_relation_drop(Oid relOid) { ObjectAddress object; char *audit_name; - uint16_t tclass; + uint16_t tclass = 0; char relkind; relkind = get_rel_relkind(relOid); @@ -580,7 +580,7 @@ sepgsql_relation_setattr(Oid relOid) Form_pg_class newform; ObjectAddress object; char *audit_name; - uint16_t tclass; + uint16_t tclass = 0; switch (get_rel_relkind(relOid)) { -- 1.8.3.1
^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-06 15:08                                       ` Joe Conway <mail@joeconway.com>
  1 sibling, 0 replies; 61+ messages in thread

From: Joe Conway @ 2017-04-06 15:08 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/05/2017 02:29 PM, Mike Palmiotto wrote:
> I'm going to hold the partition table regression changes for a
> separate patch and include some ORDER BY fixes. Will post tomorrow
> 
> In the meantime, attached are the latest and greatest patches.

I'm going to push the attached in a few hours unless there is any
additional discussion. As stated above we'll do the regression changes
in a separate patch once that is sorted. I used Tom's approach and
comment wording for 0001a.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments: download all (4 files, .tar.gz)

0001a-silence-sepgsql-compiler-warning-bool.patch (text/x-diff, 775B) download diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..5e2eba6 100644 *** a/contrib/sepgsql/label.c --- b/contrib/sepgsql/label.c *************** *** 10,15 **** --- 10,25 ---- */ #include "postgres.h" + #include <selinux/label.h> + + /* + * <selinux/label.h> includes <stdbool.h>, which creates an incompatible + * #define for bool. Get rid of that so we can use our own typedef. + * (We don't care if <stdbool.h> redefines "true"/"false"; those are close + * enough.) + */ + #undef bool + #include "access/heapam.h" #include "access/htup_details.h" #include "access/genam.h" *************** *** 37,44 **** #include "sepgsql.h" - #include <selinux/label.h> - /* * Saved hook entries (if stacked) */ --- 47,52 ----
0001b-silence-sepgsql-compiler-warning-uninitialized.patch (text/x-diff, 1014B) download diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..2ea6bfb 100644 *** a/contrib/sepgsql/relation.c --- b/contrib/sepgsql/relation.c *************** sepgsql_relation_post_create(Oid relOid) *** 243,249 **** HeapTuple tuple; Form_pg_class classForm; ObjectAddress object; ! uint16 tclass; char *scontext; /* subject */ char *tcontext; /* schema */ char *rcontext; /* relation */ --- 243,249 ---- HeapTuple tuple; Form_pg_class classForm; ObjectAddress object; ! uint16_t tclass; char *scontext; /* subject */ char *tcontext; /* schema */ char *rcontext; /* relation */ *************** sepgsql_relation_drop(Oid relOid) *** 413,419 **** { ObjectAddress object; char *audit_name; ! uint16_t tclass; char relkind; relkind = get_rel_relkind(relOid); --- 413,419 ---- { ObjectAddress object; char *audit_name; ! uint16_t tclass = 0; char relkind; relkind = get_rel_relkind(relOid);
0002-add-partitioned-table-support-to-sepgsql.patch (text/x-diff, 6.1K) download diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..4dda82a 100644 *** a/contrib/sepgsql/label.c --- b/contrib/sepgsql/label.c *************** exec_object_restorecon(struct selabel_ha *** 779,785 **** case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; --- 779,786 ---- case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION || ! relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..f8689c0 100644 *** a/contrib/sepgsql/relation.c --- b/contrib/sepgsql/relation.c *************** sepgsql_attribute_post_create(Oid relOid *** 54,65 **** ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; /* ! * Only attributes within regular relation have individual security ! * labels. */ ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 54,66 ---- ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind = get_rel_relkind(relOid); /* ! * Only attributes within regular relation or partition relations have ! * individual security labels. */ ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_drop(Oid relOid, AttrN *** 135,142 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 136,144 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_relabel(Oid relOid, At *** 167,174 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); --- 169,177 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); *************** sepgsql_attribute_setattr(Oid relOid, At *** 209,216 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 212,220 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_relation_post_create(Oid relOid) *** 291,296 **** --- 295,301 ---- switch (classForm->relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_post_create(Oid relOid) *** 333,339 **** true); /* ! * Assign the default security label on the new relation */ object.classId = RelationRelationId; object.objectId = relOid; --- 338,345 ---- true); /* ! * Assign the default security label on the new relation or partitioned ! * table. */ object.classId = RelationRelationId; object.objectId = relOid; *************** sepgsql_relation_post_create(Oid relOid) *** 341,350 **** SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assigns a default security label on columns of the new regular ! * tables. */ ! if (classForm->relkind == RELKIND_RELATION) { Relation arel; ScanKeyData akey; --- 347,356 ---- SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assign a default security label on columns of a new table. */ ! if (classForm->relkind == RELKIND_RELATION || ! classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; *************** sepgsql_relation_drop(Oid relOid) *** 414,425 **** ObjectAddress object; char *audit_name; uint16_t tclass = 0; ! char relkind; - relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: --- 420,431 ---- ObjectAddress object; char *audit_name; uint16_t tclass; ! char relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_drop(Oid relOid) *** 479,485 **** /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION) { Form_pg_attribute attForm; CatCList *attrList; --- 485,491 ---- /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; *************** sepgsql_relation_relabel(Oid relOid, con *** 521,531 **** { ObjectAddress object; char *audit_name; ! char relkind; uint16_t tclass = 0; ! relkind = get_rel_relkind(relOid); ! if (relkind == RELKIND_RELATION) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; --- 527,536 ---- { ObjectAddress object; char *audit_name; ! char relkind = get_rel_relkind(relOid); uint16_t tclass = 0; ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE;
signature.asc (application/pgp-signature, 818B) download ^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-06 15:29                                       ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 18:19                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 2 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-06 15:29 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Joe Conway <mail@joeconway.com> writes:
> I'm going to push the attached in a few hours unless there is any
> additional discussion. As stated above we'll do the regression changes
> in a separate patch once that is sorted. I used Tom's approach and
> comment wording for 0001a.

Looks generally sane, but I noticed a grammatical nitpick:

-	 * Only attributes within regular relation or partition relations have
+	 * Only attributes within regular relations or partition relations have

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-06 18:19                                         ` Joe Conway <mail@joeconway.com>
  1 sibling, 0 replies; 61+ messages in thread

From: Joe Conway @ 2017-04-06 18:19 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/06/2017 08:29 AM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> I'm going to push the attached in a few hours unless there is any
>> additional discussion. As stated above we'll do the regression changes
>> in a separate patch once that is sorted. I used Tom's approach and
>> comment wording for 0001a.
> 
> Looks generally sane, but I noticed a grammatical nitpick:
> 
> -	 * Only attributes within regular relation or partition relations have
> +	 * Only attributes within regular relations or partition relations have

Good call -- thanks!

Any thoughts on whether 0001a and 0001b ought to be backpatched? I'm
thinking not given the lack of past complaints but it might make sense
to do.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-06 19:35                                         ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  1 sibling, 1 reply; 61+ messages in thread

From: Tom Lane @ 2017-04-06 19:35 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Joe Conway <mail@joeconway.com> writes:
> Any thoughts on whether 0001a and 0001b ought to be backpatched? I'm
> thinking not given the lack of past complaints but it might make sense
> to do.

I think 0001a absolutely needs to be, because it is fixing what is really
an ABI violation: sepgsql_needs_fmgr_hook is supposed to return our notion
of bool, but as things stand it's returning _Bool (which is why the
compiler is complaining).  Now we might get away with that on most
hardware, but on platforms where those are different widths, it's possible
to imagine function-return conventions that would make it fail.

0001b seems to only be needed for compilers that aren't smart enough
to see that tclass won't be referenced for RELKIND_INDEX, so it's
just cosmetic.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-06 21:52                                           ` Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-06 21:52 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/06/2017 12:35 PM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> Any thoughts on whether 0001a and 0001b ought to be backpatched? I'm
>> thinking not given the lack of past complaints but it might make sense
>> to do.
> 
> I think 0001a absolutely needs to be, because it is fixing what is really
> an ABI violation: sepgsql_needs_fmgr_hook is supposed to return our notion
> of bool, but as things stand it's returning _Bool (which is why the
> compiler is complaining).  Now we might get away with that on most
> hardware, but on platforms where those are different widths, it's possible
> to imagine function-return conventions that would make it fail.
> 
> 0001b seems to only be needed for compilers that aren't smart enough
> to see that tclass won't be referenced for RELKIND_INDEX, so it's
> just cosmetic.

Ok, committed/pushed that way.

I found some missing bits in the 0002 patch -- new version attached.
Will wait on new regression tests before committing, but I expect we'll
have those by end of today and be able to commit the rest tomorrow.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

0002-add-partitioned-table-support-to-sepgsql.patch (text/x-diff, 8.2K) download Add partitioned table support to sepgsql The new partitioned table capability added a new relkind, namely RELKIND_PARTITIONED_TABLE. Update sepgsql to treat this new relkind exactly the same way it does RELKIND_RELATION. Issue raised by Stephen Frost and initial patch by Mike Palmiotto. Review by Tom Lane and Robert Haas, and editorializing by me. Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com diff --git a/contrib/sepgsql/dml.c b/contrib/sepgsql/dml.c index bc17089..b643720 100644 *** a/contrib/sepgsql/dml.c --- b/contrib/sepgsql/dml.c *************** check_relation_privileges(Oid relOid, *** 190,195 **** --- 190,196 ---- switch (relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: result = sepgsql_avc_check_perms(&object, SEPG_CLASS_DB_TABLE, required, *************** check_relation_privileges(Oid relOid, *** 225,231 **** /* * Only columns owned by relations shall be checked */ ! if (relkind != RELKIND_RELATION) return true; /* --- 226,232 ---- /* * Only columns owned by relations shall be checked */ ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return true; /* diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..6239800 100644 *** a/contrib/sepgsql/label.c --- b/contrib/sepgsql/label.c *************** exec_object_restorecon(struct selabel_ha *** 779,785 **** case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; --- 787,794 ---- case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION || ! relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; *************** exec_object_restorecon(struct selabel_ha *** 803,809 **** case AttributeRelationId: attForm = (Form_pg_attribute) GETSTRUCT(tuple); ! if (get_rel_relkind(attForm->attrelid) != RELKIND_RELATION) continue; /* no need to assign security label */ objtype = SELABEL_DB_COLUMN; --- 812,819 ---- case AttributeRelationId: attForm = (Form_pg_attribute) GETSTRUCT(tuple); ! if (get_rel_relkind(attForm->attrelid) != RELKIND_RELATION && ! get_rel_relkind(attForm->attrelid) != RELKIND_PARTITIONED_TABLE) continue; /* no need to assign security label */ objtype = SELABEL_DB_COLUMN; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..59a6d9b 100644 *** a/contrib/sepgsql/relation.c --- b/contrib/sepgsql/relation.c *************** sepgsql_attribute_post_create(Oid relOid *** 54,65 **** ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; /* ! * Only attributes within regular relation have individual security ! * labels. */ ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 54,66 ---- ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind = get_rel_relkind(relOid); /* ! * Only attributes within regular relations or partition relations have ! * individual security labels. */ ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_drop(Oid relOid, AttrN *** 135,142 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 136,144 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_relabel(Oid relOid, At *** 167,174 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); --- 169,177 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); *************** sepgsql_attribute_setattr(Oid relOid, At *** 209,216 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 212,220 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_relation_post_create(Oid relOid) *** 291,296 **** --- 295,301 ---- switch (classForm->relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_post_create(Oid relOid) *** 333,339 **** true); /* ! * Assign the default security label on the new relation */ object.classId = RelationRelationId; object.objectId = relOid; --- 338,345 ---- true); /* ! * Assign the default security label on the new regular or partitioned ! * relation. */ object.classId = RelationRelationId; object.objectId = relOid; *************** sepgsql_relation_post_create(Oid relOid) *** 341,350 **** SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assigns a default security label on columns of the new regular ! * tables. */ ! if (classForm->relkind == RELKIND_RELATION) { Relation arel; ScanKeyData akey; --- 347,356 ---- SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assign a default security label on columns of a new table. */ ! if (classForm->relkind == RELKIND_RELATION || ! classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; *************** sepgsql_relation_drop(Oid relOid) *** 413,425 **** { ObjectAddress object; char *audit_name; ! uint16_t tclass = 0; ! char relkind; - relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: --- 419,431 ---- { ObjectAddress object; char *audit_name; ! uint16_t tclass = 0; ! char relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_drop(Oid relOid) *** 479,485 **** /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION) { Form_pg_attribute attForm; CatCList *attrList; --- 485,491 ---- /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; *************** sepgsql_relation_relabel(Oid relOid, con *** 521,531 **** { ObjectAddress object; char *audit_name; ! char relkind; uint16_t tclass = 0; ! relkind = get_rel_relkind(relOid); ! if (relkind == RELKIND_RELATION) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; --- 527,536 ---- { ObjectAddress object; char *audit_name; ! char relkind = get_rel_relkind(relOid); uint16_t tclass = 0; ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; *************** sepgsql_relation_setattr(Oid relOid) *** 585,590 **** --- 590,596 ---- switch (get_rel_relkind(relOid)) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE:
signature.asc (application/pgp-signature, 818B) download ^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-07 18:36                                             ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-07 18:36 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Thu, Apr 6, 2017 at 5:52 PM, Joe Conway <mail@joeconway.com> wrote:
> On 04/06/2017 12:35 PM, Tom Lane wrote:
>> Joe Conway <mail@joeconway.com> writes:
>>> Any thoughts on whether 0001a and 0001b ought to be backpatched? I'm
>>> thinking not given the lack of past complaints but it might make sense
>>> to do.
>>
>> I think 0001a absolutely needs to be, because it is fixing what is really
>> an ABI violation: sepgsql_needs_fmgr_hook is supposed to return our notion
>> of bool, but as things stand it's returning _Bool (which is why the
>> compiler is complaining).  Now we might get away with that on most
>> hardware, but on platforms where those are different widths, it's possible
>> to imagine function-return conventions that would make it fail.
>>
>> 0001b seems to only be needed for compilers that aren't smart enough
>> to see that tclass won't be referenced for RELKIND_INDEX, so it's
>> just cosmetic.
>
> Ok, committed/pushed that way.
>
> I found some missing bits in the 0002 patch -- new version attached.
> Will wait on new regression tests before committing, but I expect we'll
> have those by end of today and be able to commit the rest tomorrow.

Attached are the regression test updates for partitioned tables.

Thanks,
-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-07 18:37                                               ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-07 18:37 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Fri, Apr 7, 2017 at 2:36 PM, Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
> On Thu, Apr 6, 2017 at 5:52 PM, Joe Conway <mail@joeconway.com> wrote:
>> On 04/06/2017 12:35 PM, Tom Lane wrote:
>>> Joe Conway <mail@joeconway.com> writes:
>>>> Any thoughts on whether 0001a and 0001b ought to be backpatched? I'm
>>>> thinking not given the lack of past complaints but it might make sense
>>>> to do.
>>>
>>> I think 0001a absolutely needs to be, because it is fixing what is really
>>> an ABI violation: sepgsql_needs_fmgr_hook is supposed to return our notion
>>> of bool, but as things stand it's returning _Bool (which is why the
>>> compiler is complaining).  Now we might get away with that on most
>>> hardware, but on platforms where those are different widths, it's possible
>>> to imagine function-return conventions that would make it fail.
>>>
>>> 0001b seems to only be needed for compilers that aren't smart enough
>>> to see that tclass won't be referenced for RELKIND_INDEX, so it's
>>> just cosmetic.
>>
>> Ok, committed/pushed that way.
>>
>> I found some missing bits in the 0002 patch -- new version attached.
>> Will wait on new regression tests before committing, but I expect we'll
>> have those by end of today and be able to commit the rest tomorrow.
>
> Attached are the regression test updates for partitioned tables.

Actually attached this time.
-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

0001-Add-sepgsql-regression-tests-for-partitioned-tables.patch (text/x-patch, 119.2K) download From 348e63fc6b13a7514c8145abc3b2a139598d6991 Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Fri, 7 Apr 2017 15:40:08 +0000 Subject: [PATCH] Add sepgsql regression tests for partitioned tables --- contrib/sepgsql/expected/alter.out | 103 +++++++++++++++++++- contrib/sepgsql/expected/ddl.out | 188 +++++++++++++++++++++++++++++++++++++ contrib/sepgsql/expected/dml.out | 126 ++++++++++++++++++++++--- contrib/sepgsql/expected/label.out | 157 +++++++++++++++++++++++++------ contrib/sepgsql/expected/misc.out | 160 +++++++++++++++++++++++++++++++ contrib/sepgsql/sql/alter.sql | 54 +++++++++++ contrib/sepgsql/sql/ddl.sql | 23 +++++ contrib/sepgsql/sql/dml.sql | 56 ++++++++++- contrib/sepgsql/sql/label.sql | 55 ++++++++++- contrib/sepgsql/sql/misc.sql | 15 +++ 10 files changed, 890 insertions(+), 47 deletions(-) diff --git a/contrib/sepgsql/expected/alter.out b/contrib/sepgsql/expected/alter.out index cf554c9..eb3550f 100644 --- a/contrib/sepgsql/expected/alter.out +++ b/contrib/sepgsql/expected/alter.out @@ -26,6 +26,9 @@ SET search_path = regtest_schema_1, regtest_schema_2, public; CREATE TABLE regtest_table_1 (a int, b text); CREATE TABLE regtest_table_2 (c text) inherits (regtest_table_1); CREATE TABLE regtest_table_3 (x int primary key, y text); +CREATE TABLE regtest_ptable_1 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE regtest_ptable_1_ones PARTITION OF regtest_ptable_1 FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE regtest_ptable_1_tens PARTITION OF regtest_ptable_1 FOR VALUES FROM ('10') TO ('100'); CREATE SEQUENCE regtest_seq_1; CREATE VIEW regtest_view_1 AS SELECT * FROM regtest_table_1 WHERE a > 0; CREATE FUNCTION regtest_func_1 (text) RETURNS bool @@ -54,6 +57,10 @@ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_table_1" ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user; LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_table_1" +ALTER TABLE regtest_ptable_1 OWNER TO regress_sepgsql_test_user; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1" +ALTER TABLE regtest_ptable_1_ones OWNER TO regress_sepgsql_test_user; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1_ones" ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema_1.regtest_seq_1" ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; @@ -73,6 +80,14 @@ ALTER TABLE regtest_table_1 SET SCHEMA regtest_schema_2; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_table_1" +ALTER TABLE regtest_ptable_1 SET SCHEMA regtest_schema_2; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1" +ALTER TABLE regtest_ptable_1_ones SET SCHEMA regtest_schema_2; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1_ones" ALTER SEQUENCE regtest_seq_1 SET SCHEMA regtest_schema_2; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" @@ -97,6 +112,12 @@ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_1" +ALTER TABLE regtest_ptable_1_ones RENAME TO regtest_table_part; +LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_ptable_1_ones" +ALTER TABLE regtest_ptable_1 RENAME TO regtest_ptable; +LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_ptable_1" ALTER SEQUENCE regtest_seq_1 RENAME TO regtest_seq; LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema_2.regtest_seq_1" @@ -197,6 +218,82 @@ ALTER TABLE regtest_table_2 NO INHERIT regtest_table; -- not supported ALTER TABLE regtest_table_2 INHERIT regtest_table; -- not supported ALTER TABLE regtest_table SET TABLESPACE pg_default; LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table" +-- For partitioned tables +ALTER TABLE regtest_ptable ADD COLUMN d float; +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: ALTER TABLE regtest_ptable ADD COLUMN d float; + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.d" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.d" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.d" +ALTER TABLE regtest_ptable DROP COLUMN d; +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.d" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.d" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.d" +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'abcd'; -- not supported yet +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'XYZ'; -- not supported yet +ALTER TABLE regtest_ptable ALTER p DROP DEFAULT; -- not supported yet +ALTER TABLE regtest_ptable ALTER p SET NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ALTER p DROP NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ALTER p SET STATISTICS -1; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ALTER p SET (n_distinct = 999); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +ALTER TABLE regtest_ptable ALTER p SET STORAGE PLAIN; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported +ALTER TABLE regtest_ptable DROP CONSTRAINT test_ck; -- not supported +ALTER TABLE regtest_ptable SET WITH OIDS; +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.oid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.oid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.oid" +ALTER TABLE regtest_ptable SET WITHOUT OIDS; +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.oid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.oid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.oid" +ALTER TABLE regtest_ptable SET TABLESPACE pg_default; +-- For table partitio +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'abcd'; -- not supported yet +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'XYZ'; -- not supported yet +ALTER TABLE regtest_table_part ALTER p DROP DEFAULT; -- not supported yet +ALTER TABLE regtest_table_part ALTER p SET NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p DROP NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p SET STATISTICS -1; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p SET (n_distinct = 999); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p SET STORAGE PLAIN; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported +ALTER TABLE regtest_table_part VALIDATE CONSTRAINT test_ck; -- not supported +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +ALTER TABLE regtest_table_part DROP CONSTRAINT test_ck; -- not supported +CREATE TRIGGER regtest_part_test_trig BEFORE UPDATE ON regtest_table_part + FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); +ALTER TABLE regtest_table_part DISABLE TRIGGER regtest_part_test_trig; -- not supported +ALTER TABLE regtest_table_part ENABLE TRIGGER regtest_part_test_trig; -- not supported +ALTER TABLE regtest_table_part SET (fillfactor = 75); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_part" +ALTER TABLE regtest_table_part RESET (fillfactor); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_part" +ALTER TABLE regtest_table_part SET TABLESPACE pg_default; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_part" +-- ALTER VIEW regtest_view SET (security_barrier); LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema_2.regtest_view" ALTER SEQUENCE regtest_seq INCREMENT BY 10 START WITH 1000; @@ -208,13 +305,15 @@ RESET sepgsql.debug_audit; RESET client_min_messages; DROP DATABASE sepgsql_test_regression; DROP SCHEMA regtest_schema CASCADE; -NOTICE: drop cascades to 3 other objects +NOTICE: drop cascades to 4 other objects DETAIL: drop cascades to table regtest_table_2 drop cascades to table regtest_table_3 drop cascades to constraint test_fk on table regtest_table +drop cascades to table regtest_ptable_1_tens DROP SCHEMA regtest_schema_2 CASCADE; -NOTICE: drop cascades to 4 other objects +NOTICE: drop cascades to 5 other objects DETAIL: drop cascades to table regtest_table +drop cascades to table regtest_ptable drop cascades to sequence regtest_seq drop cascades to view regtest_view drop cascades to function regtest_func(text) diff --git a/contrib/sepgsql/expected/ddl.out b/contrib/sepgsql/expected/ddl.out index de820c8..24d1927 100644 --- a/contrib/sepgsql/expected/ddl.out +++ b/contrib/sepgsql/expected/ddl.out @@ -76,14 +76,63 @@ LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.a" +CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" +CREATE TABLE regtest_ptable_ones PARTITION OF regtest_ptable FOR VALUES FROM ('0') TO ('10'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_ones" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.a" +CREATE TABLE regtest_ptable_tens PARTITION OF regtest_ptable FOR VALUES FROM ('10') TO ('100'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_tens" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.a" +ALTER TABLE regtest_ptable ADD COLUMN q int; +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: ALTER TABLE regtest_ptable ADD COLUMN q int; + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q" -- corresponding toast table should not have label and permission checks ALTER TABLE regtest_table_2 ADD COLUMN b text; LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.b" -- VACUUM FULL internally create a new table and swap them later. VACUUM FULL regtest_table; +VACUUM FULL regtest_ptable; CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view" +CREATE VIEW regtest_pview AS SELECT * FROM regtest_ptable WHERE a < 99; +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview" CREATE SEQUENCE regtest_seq; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_seq" @@ -132,9 +181,35 @@ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" +CREATE TABLE regtest_ptable_3 (o int, p serial); +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable_3 (o int, p serial); + ^ +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.p" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" CREATE VIEW regtest_view_2 AS SELECT * FROM regtest_table_3 WHERE x < y; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view_2" +CREATE VIEW regtest_pview_2 AS SELECT * FROM regtest_ptable_3 WHERE o < p; +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview_2" CREATE FUNCTION regtest_func_2(int) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RETURN $1 * $1 < 100; END'; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" @@ -213,6 +288,70 @@ LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regte LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.y" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.z" +-- For partitioned tables +CREATE TABLE regtest_ptable_4 (x int primary key, y int, z int); +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable_4 (x int primary key, y int, z i... + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: ...EATE TABLE regtest_ptable_4 (x int primary key, y int, z int... + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: ...TE TABLE regtest_ptable_4 (x int primary key, y int, z int); + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.z" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +CREATE INDEX regtest_pindex_tbl4_y ON regtest_ptable_4(y); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +CREATE INDEX regtest_pindex_tbl4_z ON regtest_ptable_4(z); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +ALTER TABLE regtest_ptable_4 ALTER COLUMN y TYPE float; +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.float8(integer)" +DROP INDEX regtest_pindex_tbl4_y; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +ALTER TABLE regtest_ptable_4 + ADD CONSTRAINT regtest_ptbl4_con EXCLUDE USING btree (z WITH =); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +DROP TABLE regtest_ptable_4 CASCADE; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.z" -- -- DROP Permission checks (with clean-up) -- @@ -234,6 +373,13 @@ ALTER TABLE regtest_table DROP COLUMN y; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.y" ALTER TABLE regtest_table_2 SET WITHOUT OIDS; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid" +ALTER TABLE regtest_ptable DROP COLUMN q CASCADE; +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q" +NOTICE: drop cascades to view regtest_pview +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" DROP TABLE regtest_table; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" @@ -249,14 +395,56 @@ LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regte LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.z" +DROP TABLE regtest_ptable CASCADE; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_tens" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.a" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_ones" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.a" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" DROP OWNED BY regress_sepgsql_test_user; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_func_2(integer)" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview_2" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view_2" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.p" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_3" diff --git a/contrib/sepgsql/expected/dml.out b/contrib/sepgsql/expected/dml.out index 8716ac7..ccf031d 100644 --- a/contrib/sepgsql/expected/dml.out +++ b/contrib/sepgsql/expected/dml.out @@ -21,6 +21,21 @@ SECURITY LABEL ON TABLE t5 IS 'system_u:object_r:sepgsql_table_t:s0'; SECURITY LABEL ON COLUMN t5.e IS 'system_u:object_r:sepgsql_table_t:s0'; SECURITY LABEL ON COLUMN t5.f IS 'system_u:object_r:sepgsql_ro_table_t:s0'; SECURITY LABEL ON COLUMN t5.g IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o); +SECURITY LABEL ON TABLE t1p IS 'system_u:object_r:sepgsql_table_t:s0'; +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +SECURITY LABEL ON TABLE t1p_ones IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.o IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +SECURITY LABEL ON TABLE t1p_tens IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.o IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.p IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +CREATE TABLE t1p_hunds PARTITION OF t1p FOR VALUES FROM ('100') TO ('1000'); +SECURITY LABEL ON TABLE t1p_hunds IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_hunds.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_hunds.p IS 'system_u:object_r:sepgsql_table_t:s0'; +INSERT INTO t1p VALUES (0, 'aaa'), (9, 'bbb'), (10, 'ccc'), (99, 'ddd'), (100, 'eee'); CREATE TABLE customer (cid int primary key, cname text, ccredit text); SECURITY LABEL ON COLUMN customer.ccredit IS 'system_u:object_r:sepgsql_secret_table_t:s0'; INSERT INTO customer VALUES (1, 'Taro', '1111-2222-3333-4444'), @@ -33,24 +48,45 @@ SECURITY LABEL ON FUNCTION customer_credit(int) SELECT objtype, objname, label FROM pg_seclabels WHERE provider = 'selinux' AND objtype in ('table', 'column') - AND objname in ('t1', 't2', 't3', 't4', 't5', 't5.e', 't5.f', 't5.g') + AND objname in ('t1', 't2', 't3', 't4', + 't5', 't5.e', 't5.f', 't5.g', + 't1p', 't1p.o', 't1p.p', + 't1p_ones', 't1p_ones.o', 't1p_ones.p', + 't1p_tens', 't1p_tens.o', 't1p_tens.p', + 't1p_hunds', 't1p_hunds.o', 't1p_hunds.p') ORDER BY objname; - objtype | objname | label ----------+---------+--------------------------------------------- - table | t1 | system_u:object_r:sepgsql_table_t:s0 - table | t2 | system_u:object_r:sepgsql_ro_table_t:s0 - table | t3 | system_u:object_r:sepgsql_fixed_table_t:s0 - table | t4 | system_u:object_r:sepgsql_secret_table_t:s0 - table | t5 | system_u:object_r:sepgsql_table_t:s0 - column | t5.e | system_u:object_r:sepgsql_table_t:s0 - column | t5.f | system_u:object_r:sepgsql_ro_table_t:s0 - column | t5.g | system_u:object_r:sepgsql_secret_table_t:s0 -(8 rows) + objtype | objname | label +---------+-------------+--------------------------------------------- + table | t1 | system_u:object_r:sepgsql_table_t:s0 + table | t1p | system_u:object_r:sepgsql_table_t:s0 + table | t1p_hunds | system_u:object_r:sepgsql_table_t:s0 + column | t1p_hunds.o | system_u:object_r:sepgsql_table_t:s0 + column | t1p_hunds.p | system_u:object_r:sepgsql_table_t:s0 + column | t1p.o | unconfined_u:object_r:sepgsql_table_t:s0 + table | t1p_ones | system_u:object_r:sepgsql_ro_table_t:s0 + column | t1p_ones.o | system_u:object_r:sepgsql_ro_table_t:s0 + column | t1p_ones.p | system_u:object_r:sepgsql_ro_table_t:s0 + column | t1p.p | unconfined_u:object_r:sepgsql_table_t:s0 + table | t1p_tens | system_u:object_r:sepgsql_secret_table_t:s0 + column | t1p_tens.o | system_u:object_r:sepgsql_secret_table_t:s0 + column | t1p_tens.p | system_u:object_r:sepgsql_secret_table_t:s0 + table | t2 | system_u:object_r:sepgsql_ro_table_t:s0 + table | t3 | system_u:object_r:sepgsql_fixed_table_t:s0 + table | t4 | system_u:object_r:sepgsql_secret_table_t:s0 + table | t5 | system_u:object_r:sepgsql_table_t:s0 + column | t5.e | system_u:object_r:sepgsql_table_t:s0 + column | t5.f | system_u:object_r:sepgsql_ro_table_t:s0 + column | t5.g | system_u:object_r:sepgsql_secret_table_t:s0 +(20 rows) CREATE SCHEMA my_schema_1; CREATE TABLE my_schema_1.ts1 (a int, b text); +CREATE TABLE my_schema_1.pts1 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_1.pts1_ones PARTITION OF my_schema_1.pts1 FOR VALUES FROM ('0') to ('10'); CREATE SCHEMA my_schema_2; CREATE TABLE my_schema_2.ts2 (x int, y text); +CREATE TABLE my_schema_2.pts2 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_2.pts2_tens PARTITION OF my_schema_2.pts2 FOR VALUES FROM ('10') to ('100'); SECURITY LABEL ON SCHEMA my_schema_2 IS 'system_u:object_r:sepgsql_regtest_invisible_schema_t:s0'; -- Hardwired Rules @@ -99,6 +135,23 @@ SELECT e,f FROM t5; -- ok ---+--- (0 rows) +SELECT * FROM t1p; -- failed +ERROR: SELinux: security policy violation +SELECT * FROM t1p_ones; -- ok + o | p +---+----- + 0 | aaa + 9 | bbb +(2 rows) + +SELECT * FROM t1p_tens; -- failed +ERROR: SELinux: security policy violation +SELECT * FROM t1p_hunds; -- ok + o | p +-----+----- + 100 | eee +(1 row) + SELECT * FROM customer; -- failed ERROR: SELinux: security policy violation SELECT cid, cname, customer_credit(cid) FROM customer; -- ok @@ -116,6 +169,22 @@ SELECT count(*) FROM t5; -- ok SELECT count(*) FROM t5 WHERE g IS NULL; -- failed ERROR: SELinux: security policy violation +SELECT count(*) FROM t1p; -- failed +ERROR: SELinux: security policy violation +SELECT count(*) FROM t1p_ones; -- ok + count +------- + 2 +(1 row) + +SELECT count(*) FROM t1p WHERE o IS NULL; -- failed +ERROR: SELinux: security policy violation +SELECT count(*) FROM t1p_ones WHERE o IS NULL; -- ok + count +------- + 0 +(1 row) + INSERT INTO t1 VALUES (4, 'abc'); -- ok INSERT INTO t2 VALUES (4, 'xyz'); -- failed ERROR: SELinux: security policy violation @@ -127,6 +196,11 @@ ERROR: SELinux: security policy violation INSERT INTO t5 (e,f) VALUES ('abc', 'def'); -- failed ERROR: SELinux: security policy violation INSERT INTO t5 (e) VALUES ('abc'); -- ok +INSERT INTO t1p_tens (o,p) VALUES (99, 'pqr'); -- failed +ERROR: SELinux: security policy violation +INSERT INTO t1p_ones (o,p) VALUES (9, 'stu'); -- failed +ERROR: SELinux: security policy violation +INSERT INTO t1p_hunds (o,p) VALUES (999, 'stu'); -- ok UPDATE t1 SET b = b || '_upd'; -- ok UPDATE t2 SET y = y || '_upd'; -- failed ERROR: SELinux: security policy violation @@ -138,6 +212,15 @@ UPDATE t5 SET e = 'xyz'; -- ok UPDATE t5 SET e = f || '_upd'; -- ok UPDATE t5 SET e = g || '_upd'; -- failed ERROR: SELinux: security policy violation +UPDATE t1p SET o = 99; -- failed +ERROR: SELinux: security policy violation +UPDATE t1p SET o = 0; -- failed +ERROR: SELinux: security policy violation +UPDATE t1p SET o = 999; -- failed +ERROR: SELinux: security policy violation +UPDATE t1p_ones SET o = 9; -- failed +ERROR: SELinux: security policy violation +UPDATE t1p_hunds SET o = 900; -- ok DELETE FROM t1; -- ok DELETE FROM t2; -- failed ERROR: SELinux: security policy violation @@ -149,6 +232,11 @@ DELETE FROM t5; -- ok DELETE FROM t5 WHERE f IS NULL; -- ok DELETE FROM t5 WHERE g IS NULL; -- failed ERROR: SELinux: security policy violation +DELETE FROM t1p_ones WHERE o IS NULL; -- failed +ERROR: SELinux: security policy violation +DELETE FROM t1p_tens WHERE p IS NULL; -- failed +ERROR: SELinux: security policy violation +DELETE FROM t1p_hunds WHERE p IS NULL; -- ok -- -- COPY TO/FROM statements -- @@ -160,6 +248,11 @@ ERROR: SELinux: security policy violation COPY t5 TO '/dev/null'; -- failed ERROR: SELinux: security policy violation COPY t5(e,f) TO '/dev/null'; -- ok +COPY (SELECT * FROM t1p) TO '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY t1p_ones TO '/dev/null'; -- ok +COPY t1p_tens TO '/dev/null'; -- failed +ERROR: SELinux: security policy violation COPY t1 FROM '/dev/null'; -- ok COPY t2 FROM '/dev/null'; -- failed ERROR: SELinux: security policy violation @@ -202,8 +295,13 @@ DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; DROP TABLE IF EXISTS t5 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; DROP TABLE IF EXISTS customer CASCADE; DROP SCHEMA IF EXISTS my_schema_1 CASCADE; -NOTICE: drop cascades to table my_schema_1.ts1 +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table my_schema_1.ts1 +drop cascades to table my_schema_1.pts1 DROP SCHEMA IF EXISTS my_schema_2 CASCADE; -NOTICE: drop cascades to table my_schema_2.ts2 +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table my_schema_2.ts2 +drop cascades to table my_schema_2.pts2 diff --git a/contrib/sepgsql/expected/label.out b/contrib/sepgsql/expected/label.out index 638e138..d34df11 100644 --- a/contrib/sepgsql/expected/label.out +++ b/contrib/sepgsql/expected/label.out @@ -53,6 +53,18 @@ CREATE TABLE var_tbl(x int, y text); INSERT INTO var_tbl VALUES (2,'xxx'), (3,'yyy'), (4,'zzz'), (5,'xyz'); SECURITY LABEL ON TABLE var_tbl IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; +CREATE TABLE foo_ptbl(o int, p text) PARTITION BY RANGE (o); +CREATE TABLE foo_ptbl_ones PARTITION OF foo_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE foo_ptbl_tens PARTITION OF foo_ptbl FOR VALUES FROM ('10') TO ('100'); +INSERT INTO foo_ptbl VALUES (0, 'aaa'), (9,'bbb'), (10,'ccc'), (99,'ddd'); +SECURITY LABEL ON TABLE foo_ptbl + IS 'system_u:object_r:sepgsql_regtest_foo_table_t:s0'; +CREATE TABLE var_ptbl(q int, r text) PARTITION BY RANGE (q); +CREATE TABLE var_ptbl_ones PARTITION OF var_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE var_ptbl_tens PARTITION OF var_ptbl FOR VALUES FROM ('10') TO ('100'); +INSERT INTO var_ptbl VALUES (0,'xxx'), (9,'yyy'), (10,'zzz'), (99,'xyz'); +SECURITY LABEL ON TABLE var_ptbl + IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; -- -- Tests for default labeling behavior -- @@ -72,36 +84,90 @@ SELECT sepgsql_getcon(); -- confirm client privilege CREATE TABLE t4 (m int, n text); INSERT INTO t4 VALUES (1,'mmm'), (2,'nnn'), (3,'ooo'); +SELECT sepgsql_getcon(); -- confirm client privilege + sepgsql_getcon +----------------------------------------------------- + unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 +(1 row) + +CREATE TABLE tpart (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE tpart_ones PARTITION OF tpart FOR VALUES FROM ('0') TO ('10'); +SELECT sepgsql_getcon(); -- confirm client privilege + sepgsql_getcon +---------------------------------------------------- + unconfined_u:unconfined_r:sepgsql_regtest_dba_t:s0 +(1 row) + +CREATE TABLE tpart_tens PARTITION OF tpart FOR VALUES FROM ('10') TO ('100'); +INSERT INTO tpart VALUES (0, 'aaa'); +INSERT INTO tpart VALUES (9, 'bbb'); +INSERT INTO tpart VALUES (99, 'ccc'); SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3'); - objtype | objname | label ----------+---------+----------------------------------------------- - table | t1 | unconfined_u:object_r:sepgsql_table_t:s0 - table | t2 | unconfined_u:object_r:sepgsql_table_t:s0 - table | t3 | unconfined_u:object_r:user_sepgsql_table_t:s0 -(3 rows) + WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3', + 'tpart', + 'tpart_ones', + 'tpart_tens') + ORDER BY objname ASC; + objtype | objname | label +---------+------------+----------------------------------------------- + table | t1 | unconfined_u:object_r:sepgsql_table_t:s0 + table | t2 | unconfined_u:object_r:sepgsql_table_t:s0 + table | t3 | unconfined_u:object_r:user_sepgsql_table_t:s0 + table | tpart | unconfined_u:object_r:user_sepgsql_table_t:s0 + table | tpart_ones | unconfined_u:object_r:user_sepgsql_table_t:s0 + table | tpart_tens | unconfined_u:object_r:sepgsql_table_t:s0 +(6 rows) SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' OR objname like 't4.%'); - objtype | objname | label ----------+-------------+----------------------------------------------- - column | t3.t | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.s | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t4.n | unconfined_u:object_r:sepgsql_table_t:s0 - column | t4.m | unconfined_u:object_r:sepgsql_table_t:s0 - column | t4.ctid | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.xmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.cmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.xmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.cmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.tableoid | unconfined_u:object_r:sepgsql_sysobj_t:s0 -(16 rows) + WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' + OR objname like 't4.%' + OR objname like 'tpart.%' + OR objname like 'tpart_ones.%' + OR objname like 'tpart_tens.%') + ORDER BY objname ASC; + objtype | objname | label +---------+---------------------+----------------------------------------------- + column | t3.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.s | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.t | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t4.cmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.cmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.ctid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.m | unconfined_u:object_r:sepgsql_table_t:s0 + column | t4.n | unconfined_u:object_r:sepgsql_table_t:s0 + column | t4.tableoid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.xmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.xmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.o | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.o | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.p | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.p | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_tens.cmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.cmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.ctid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.o | unconfined_u:object_r:sepgsql_table_t:s0 + column | tpart_tens.p | unconfined_u:object_r:sepgsql_table_t:s0 + column | tpart_tens.tableoid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.xmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.xmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 +(40 rows) -- -- Tests for SECURITY LABEL @@ -122,6 +188,16 @@ SECURITY LABEL ON COLUMN t2 ERROR: column name must be qualified SECURITY LABEL ON COLUMN t2.b IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'invalid security context'; -- be failed +ERROR: SELinux: invalid security label: "invalid security context" +SECURITY LABEL ON COLUMN tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- be failed +ERROR: column name must be qualified +SECURITY LABEL ON COLUMN tpart.o + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok -- -- Tests for Trusted Procedures -- @@ -422,8 +498,19 @@ SELECT * FROM foo_tbl; -- OK 4 | ddd (4 rows) +SELECT * FROM foo_ptbl; -- OK + o | p +----+----- + 0 | aaa + 9 | bbb + 10 | ccc + 99 | ddd +(4 rows) + SELECT * FROM var_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM var_ptbl; -- failed +ERROR: SELinux: security policy violation SELECT * FROM auth_tbl; -- failed ERROR: SELinux: security policy violation SELECT sepgsql_setcon(NULL); -- end of session @@ -441,8 +528,12 @@ SELECT sepgsql_getcon(); -- the pooler cannot touch these tables directly SELECT * FROM foo_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM foo_ptbl; -- failed +ERROR: SELinux: security policy violation SELECT * FROM var_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM var_ptbl; -- failed +ERROR: SELinux: security policy violation -- switch to "var" SELECT auth_func('var', 'b2145aac704ce76dbe1ac7adac535b23'); auth_func @@ -458,6 +549,8 @@ SELECT sepgsql_getcon(); SELECT * FROM foo_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM foo_ptbl; -- failed +ERROR: SELinux: security policy violation SELECT * FROM var_tbl; -- OK x | y ---+----- @@ -467,6 +560,15 @@ SELECT * FROM var_tbl; -- OK 5 | xyz (4 rows) +SELECT * FROM var_ptbl; -- OK + q | r +----+----- + 0 | xxx + 9 | yyy + 10 | zzz + 99 | xyz +(4 rows) + SELECT * FROM auth_tbl; -- failed ERROR: SELinux: security policy violation SELECT sepgsql_setcon(NULL); -- end of session @@ -501,6 +603,7 @@ DROP TABLE IF EXISTS t1 CASCADE; DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; +DROP TABLE IF EXISTS tpart CASCADE; DROP FUNCTION IF EXISTS f1() CASCADE; DROP FUNCTION IF EXISTS f2() CASCADE; DROP FUNCTION IF EXISTS f3() CASCADE; diff --git a/contrib/sepgsql/expected/misc.out b/contrib/sepgsql/expected/misc.out index f877e7b..7b55142 100644 --- a/contrib/sepgsql/expected/misc.out +++ b/contrib/sepgsql/expected/misc.out @@ -8,6 +8,10 @@ ERROR: SELinux: LOAD is not permitted -- CREATE TABLE t1 (x int, y text); INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(1,100) x); +CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +INSERT INTO t1p (SELECT x, md5(x::text) FROM generate_series(0,99) x); SET sepgsql.debug_audit = on; SET client_min_messages = log; -- regular function and operators @@ -27,6 +31,57 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re 100 | f899139df5e1059396431415e770c6dd (6 rows) +SELECT * FROM t1p WHERE o > 50 AND p like '%64%'; +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4eq(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4le(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4eq(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4le(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4le(integer,integer)" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4gt(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" + o | p +----+---------------------------------- + 77 | 28dd2c7955ce926456240b2ff0100bde + 89 | 7647966b7343c29048673252e490f736 + 90 | 8613985ec49eb8f757ae6439e879bb2a + 91 | 54229abfcfa5649e7003b83dd4755294 + 99 | ac627ab1ccbdb62ec96e702f07f6425b +(5 rows) + +SELECT * FROM t1p_ones WHERE o > 50 AND p like '%64%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4gt(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" + o | p +---+--- +(0 rows) + +SELECT * FROM t1p_tens WHERE o > 50 AND p like '%64%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4gt(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" + o | p +----+---------------------------------- + 77 | 28dd2c7955ce926456240b2ff0100bde + 89 | 7647966b7343c29048673252e490f736 + 90 | 8613985ec49eb8f757ae6439e879bb2a + 91 | 54229abfcfa5649e7003b83dd4755294 + 99 | ac627ab1ccbdb62ec96e702f07f6425b +(5 rows) + -- aggregate function SELECT MIN(x), AVG(x) FROM t1; LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1" @@ -41,6 +96,49 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re 1 | 50.5000000000000000 (1 row) +SELECT MIN(o), AVG(o) FROM t1p; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.avg(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4_avg_accum(bigint[],integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int8_avg(bigint[])" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.min(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4smaller(integer,integer)" + min | avg +-----+--------------------- + 0 | 49.5000000000000000 +(1 row) + +SELECT MIN(o), AVG(o) FROM t1p_ones; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.avg(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4_avg_accum(bigint[],integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int8_avg(bigint[])" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.min(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4smaller(integer,integer)" + min | avg +-----+-------------------- + 0 | 4.5000000000000000 +(1 row) + +SELECT MIN(o), AVG(o) FROM t1p_tens; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.avg(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4_avg_accum(bigint[],integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int8_avg(bigint[])" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.min(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4smaller(integer,integer)" + min | avg +-----+--------------------- + 10 | 54.5000000000000000 +(1 row) + -- window function SELECT row_number() OVER (order by x), * FROM t1 WHERE y like '%86%'; LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1" @@ -64,9 +162,71 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re 12 | 94 | f4b9ec30ad9f68f89b29639786cb62ef (12 rows) +SELECT row_number() OVER (order by o), * FROM t1p WHERE p like '%86%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.row_number()" + row_number | o | p +------------+----+---------------------------------- + 1 | 2 | c81e728d9d4c2f636f067f89cc14862c + 2 | 17 | 70efdf2ec9b086079795c442636b55fb + 3 | 22 | b6d767d2f8ed5d21a44b0e5886680cb9 + 4 | 27 | 02e74f10e0327ad868d138f2b4fdd6f0 + 5 | 33 | 182be0c5cdcd5072bb1864cdee4d3d6e + 6 | 43 | 17e62166fc8586dfa4d1bc0e1742c08b + 7 | 54 | a684eceee76fc522773286a895bc8436 + 8 | 73 | d2ddea18f00665ce8623e36bd4e3c7c5 + 9 | 76 | fbd7939d674997cdb4692d34de8633c4 + 10 | 89 | 7647966b7343c29048673252e490f736 + 11 | 90 | 8613985ec49eb8f757ae6439e879bb2a + 12 | 94 | f4b9ec30ad9f68f89b29639786cb62ef +(12 rows) + +SELECT row_number() OVER (order by o), * FROM t1p_ones WHERE p like '%86%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.row_number()" + row_number | o | p +------------+---+---------------------------------- + 1 | 2 | c81e728d9d4c2f636f067f89cc14862c +(1 row) + +SELECT row_number() OVER (order by o), * FROM t1p_tens WHERE p like '%86%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.row_number()" + row_number | o | p +------------+----+---------------------------------- + 1 | 17 | 70efdf2ec9b086079795c442636b55fb + 2 | 22 | b6d767d2f8ed5d21a44b0e5886680cb9 + 3 | 27 | 02e74f10e0327ad868d138f2b4fdd6f0 + 4 | 33 | 182be0c5cdcd5072bb1864cdee4d3d6e + 5 | 43 | 17e62166fc8586dfa4d1bc0e1742c08b + 6 | 54 | a684eceee76fc522773286a895bc8436 + 7 | 73 | d2ddea18f00665ce8623e36bd4e3c7c5 + 8 | 76 | fbd7939d674997cdb4692d34de8633c4 + 9 | 89 | 7647966b7343c29048673252e490f736 + 10 | 90 | 8613985ec49eb8f757ae6439e879bb2a + 11 | 94 | f4b9ec30ad9f68f89b29639786cb62ef +(11 rows) + RESET sepgsql.debug_audit; RESET client_min_messages; -- -- Cleanup -- DROP TABLE IF EXISTS t1 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; diff --git a/contrib/sepgsql/sql/alter.sql b/contrib/sepgsql/sql/alter.sql index 0bd3527..58b1db3 100644 --- a/contrib/sepgsql/sql/alter.sql +++ b/contrib/sepgsql/sql/alter.sql @@ -32,6 +32,11 @@ CREATE TABLE regtest_table_2 (c text) inherits (regtest_table_1); CREATE TABLE regtest_table_3 (x int primary key, y text); +CREATE TABLE regtest_ptable_1 (o int, p text) PARTITION BY RANGE (o); + +CREATE TABLE regtest_ptable_1_ones PARTITION OF regtest_ptable_1 FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE regtest_ptable_1_tens PARTITION OF regtest_ptable_1 FOR VALUES FROM ('10') TO ('100'); + CREATE SEQUENCE regtest_seq_1; CREATE VIEW regtest_view_1 AS SELECT * FROM regtest_table_1 WHERE a > 0; @@ -55,6 +60,8 @@ ALTER SCHEMA regtest_schema_1 OWNER TO regress_sepgsql_test_user; ALTER SCHEMA regtest_schema_1 OWNER TO regress_sepgsql_test_user; ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user; ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user; +ALTER TABLE regtest_ptable_1 OWNER TO regress_sepgsql_test_user; +ALTER TABLE regtest_ptable_1_ones OWNER TO regress_sepgsql_test_user; ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; ALTER VIEW regtest_view_1 OWNER TO regress_sepgsql_test_user; @@ -66,6 +73,8 @@ ALTER FUNCTION regtest_func_1(text) OWNER TO regress_sepgsql_test_user; -- ALTER xxx SET SCHEMA -- ALTER TABLE regtest_table_1 SET SCHEMA regtest_schema_2; +ALTER TABLE regtest_ptable_1 SET SCHEMA regtest_schema_2; +ALTER TABLE regtest_ptable_1_ones SET SCHEMA regtest_schema_2; ALTER SEQUENCE regtest_seq_1 SET SCHEMA regtest_schema_2; ALTER VIEW regtest_view_1 SET SCHEMA regtest_schema_2; ALTER FUNCTION regtest_func_1(text) SET SCHEMA regtest_schema_2; @@ -76,6 +85,8 @@ ALTER FUNCTION regtest_func_1(text) SET SCHEMA regtest_schema_2; ALTER DATABASE sepgsql_test_regression_1 RENAME TO sepgsql_test_regression; ALTER SCHEMA regtest_schema_1 RENAME TO regtest_schema; ALTER TABLE regtest_table_1 RENAME TO regtest_table; +ALTER TABLE regtest_ptable_1_ones RENAME TO regtest_table_part; +ALTER TABLE regtest_ptable_1 RENAME TO regtest_ptable; ALTER SEQUENCE regtest_seq_1 RENAME TO regtest_seq; ALTER VIEW regtest_view_1 RENAME TO regtest_view; ALTER FUNCTION regtest_func_1(text) RENAME TO regtest_func; @@ -121,6 +132,49 @@ ALTER TABLE regtest_table_2 NO INHERIT regtest_table; -- not supported ALTER TABLE regtest_table_2 INHERIT regtest_table; -- not supported ALTER TABLE regtest_table SET TABLESPACE pg_default; +-- For partitioned tables +ALTER TABLE regtest_ptable ADD COLUMN d float; +ALTER TABLE regtest_ptable DROP COLUMN d; +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'abcd'; -- not supported yet +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'XYZ'; -- not supported yet +ALTER TABLE regtest_ptable ALTER p DROP DEFAULT; -- not supported yet +ALTER TABLE regtest_ptable ALTER p SET NOT NULL; +ALTER TABLE regtest_ptable ALTER p DROP NOT NULL; +ALTER TABLE regtest_ptable ALTER p SET STATISTICS -1; +ALTER TABLE regtest_ptable ALTER p SET (n_distinct = 999); +ALTER TABLE regtest_ptable ALTER p SET STORAGE PLAIN; +ALTER TABLE regtest_ptable ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported +ALTER TABLE regtest_ptable DROP CONSTRAINT test_ck; -- not supported + +ALTER TABLE regtest_ptable SET WITH OIDS; +ALTER TABLE regtest_ptable SET WITHOUT OIDS; +ALTER TABLE regtest_ptable SET TABLESPACE pg_default; + +-- For table partition +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'abcd'; -- not supported yet +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'XYZ'; -- not supported yet +ALTER TABLE regtest_table_part ALTER p DROP DEFAULT; -- not supported yet +ALTER TABLE regtest_table_part ALTER p SET NOT NULL; +ALTER TABLE regtest_table_part ALTER p DROP NOT NULL; +ALTER TABLE regtest_table_part ALTER p SET STATISTICS -1; +ALTER TABLE regtest_table_part ALTER p SET (n_distinct = 999); +ALTER TABLE regtest_table_part ALTER p SET STORAGE PLAIN; +ALTER TABLE regtest_table_part ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported +ALTER TABLE regtest_table_part VALIDATE CONSTRAINT test_ck; -- not supported +ALTER TABLE regtest_table_part DROP CONSTRAINT test_ck; -- not supported + +CREATE TRIGGER regtest_part_test_trig BEFORE UPDATE ON regtest_table_part + FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); + +ALTER TABLE regtest_table_part DISABLE TRIGGER regtest_part_test_trig; -- not supported +ALTER TABLE regtest_table_part ENABLE TRIGGER regtest_part_test_trig; -- not supported + +ALTER TABLE regtest_table_part SET (fillfactor = 75); +ALTER TABLE regtest_table_part RESET (fillfactor); + +ALTER TABLE regtest_table_part SET TABLESPACE pg_default; +-- + ALTER VIEW regtest_view SET (security_barrier); ALTER SEQUENCE regtest_seq INCREMENT BY 10 START WITH 1000; diff --git a/contrib/sepgsql/sql/ddl.sql b/contrib/sepgsql/sql/ddl.sql index 2fc66e4..3358ad1 100644 --- a/contrib/sepgsql/sql/ddl.sql +++ b/contrib/sepgsql/sql/ddl.sql @@ -32,13 +32,21 @@ ALTER TABLE regtest_table ADD COLUMN z int; CREATE TABLE regtest_table_2 (a int) WITH OIDS; +CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); +CREATE TABLE regtest_ptable_ones PARTITION OF regtest_ptable FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE regtest_ptable_tens PARTITION OF regtest_ptable FOR VALUES FROM ('10') TO ('100'); + +ALTER TABLE regtest_ptable ADD COLUMN q int; + -- corresponding toast table should not have label and permission checks ALTER TABLE regtest_table_2 ADD COLUMN b text; -- VACUUM FULL internally create a new table and swap them later. VACUUM FULL regtest_table; +VACUUM FULL regtest_ptable; CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; +CREATE VIEW regtest_pview AS SELECT * FROM regtest_ptable WHERE a < 99; CREATE SEQUENCE regtest_seq; @@ -57,8 +65,10 @@ SET SESSION AUTHORIZATION regress_sepgsql_test_user; SET search_path = regtest_schema, public; CREATE TABLE regtest_table_3 (x int, y serial); +CREATE TABLE regtest_ptable_3 (o int, p serial); CREATE VIEW regtest_view_2 AS SELECT * FROM regtest_table_3 WHERE x < y; +CREATE VIEW regtest_pview_2 AS SELECT * FROM regtest_ptable_3 WHERE o < p; CREATE FUNCTION regtest_func_2(int) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RETURN $1 * $1 < 100; END'; @@ -77,6 +87,16 @@ ALTER TABLE regtest_table_4 ADD CONSTRAINT regtest_tbl4_con EXCLUDE USING btree (z WITH =); DROP TABLE regtest_table_4 CASCADE; +-- For partitioned tables +CREATE TABLE regtest_ptable_4 (x int primary key, y int, z int); +CREATE INDEX regtest_pindex_tbl4_y ON regtest_ptable_4(y); +CREATE INDEX regtest_pindex_tbl4_z ON regtest_ptable_4(z); +ALTER TABLE regtest_ptable_4 ALTER COLUMN y TYPE float; +DROP INDEX regtest_pindex_tbl4_y; +ALTER TABLE regtest_ptable_4 + ADD CONSTRAINT regtest_ptbl4_con EXCLUDE USING btree (z WITH =); +DROP TABLE regtest_ptable_4 CASCADE; + -- -- DROP Permission checks (with clean-up) -- @@ -90,7 +110,10 @@ DROP VIEW regtest_view; ALTER TABLE regtest_table DROP COLUMN y; ALTER TABLE regtest_table_2 SET WITHOUT OIDS; +ALTER TABLE regtest_ptable DROP COLUMN q CASCADE; + DROP TABLE regtest_table; +DROP TABLE regtest_ptable CASCADE; DROP OWNED BY regress_sepgsql_test_user; diff --git a/contrib/sepgsql/sql/dml.sql b/contrib/sepgsql/sql/dml.sql index 7a64b9e..830d669 100644 --- a/contrib/sepgsql/sql/dml.sql +++ b/contrib/sepgsql/sql/dml.sql @@ -27,6 +27,26 @@ SECURITY LABEL ON COLUMN t5.e IS 'system_u:object_r:sepgsql_table_t:s0'; SECURITY LABEL ON COLUMN t5.f IS 'system_u:object_r:sepgsql_ro_table_t:s0'; SECURITY LABEL ON COLUMN t5.g IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o); +SECURITY LABEL ON TABLE t1p IS 'system_u:object_r:sepgsql_table_t:s0'; + +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +SECURITY LABEL ON TABLE t1p_ones IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.o IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; + +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +SECURITY LABEL ON TABLE t1p_tens IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.o IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.p IS 'system_u:object_r:sepgsql_secret_table_t:s0'; + +CREATE TABLE t1p_hunds PARTITION OF t1p FOR VALUES FROM ('100') TO ('1000'); +SECURITY LABEL ON TABLE t1p_hunds IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_hunds.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_hunds.p IS 'system_u:object_r:sepgsql_table_t:s0'; + +INSERT INTO t1p VALUES (0, 'aaa'), (9, 'bbb'), (10, 'ccc'), (99, 'ddd'), (100, 'eee'); + CREATE TABLE customer (cid int primary key, cname text, ccredit text); SECURITY LABEL ON COLUMN customer.ccredit IS 'system_u:object_r:sepgsql_secret_table_t:s0'; INSERT INTO customer VALUES (1, 'Taro', '1111-2222-3333-4444'), @@ -40,13 +60,23 @@ SECURITY LABEL ON FUNCTION customer_credit(int) SELECT objtype, objname, label FROM pg_seclabels WHERE provider = 'selinux' AND objtype in ('table', 'column') - AND objname in ('t1', 't2', 't3', 't4', 't5', 't5.e', 't5.f', 't5.g') + AND objname in ('t1', 't2', 't3', 't4', + 't5', 't5.e', 't5.f', 't5.g', + 't1p', 't1p.o', 't1p.p', + 't1p_ones', 't1p_ones.o', 't1p_ones.p', + 't1p_tens', 't1p_tens.o', 't1p_tens.p', + 't1p_hunds', 't1p_hunds.o', 't1p_hunds.p') ORDER BY objname; CREATE SCHEMA my_schema_1; CREATE TABLE my_schema_1.ts1 (a int, b text); +CREATE TABLE my_schema_1.pts1 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_1.pts1_ones PARTITION OF my_schema_1.pts1 FOR VALUES FROM ('0') to ('10'); + CREATE SCHEMA my_schema_2; CREATE TABLE my_schema_2.ts2 (x int, y text); +CREATE TABLE my_schema_2.pts2 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_2.pts2_tens PARTITION OF my_schema_2.pts2 FOR VALUES FROM ('10') to ('100'); SECURITY LABEL ON SCHEMA my_schema_2 IS 'system_u:object_r:sepgsql_regtest_invisible_schema_t:s0'; @@ -66,12 +96,19 @@ SELECT * FROM t3; -- ok SELECT * FROM t4; -- failed SELECT * FROM t5; -- failed SELECT e,f FROM t5; -- ok - +SELECT * FROM t1p; -- failed +SELECT * FROM t1p_ones; -- ok +SELECT * FROM t1p_tens; -- failed +SELECT * FROM t1p_hunds; -- ok SELECT * FROM customer; -- failed SELECT cid, cname, customer_credit(cid) FROM customer; -- ok SELECT count(*) FROM t5; -- ok SELECT count(*) FROM t5 WHERE g IS NULL; -- failed +SELECT count(*) FROM t1p; -- failed +SELECT count(*) FROM t1p_ones; -- ok +SELECT count(*) FROM t1p WHERE o IS NULL; -- failed +SELECT count(*) FROM t1p_ones WHERE o IS NULL; -- ok INSERT INTO t1 VALUES (4, 'abc'); -- ok INSERT INTO t2 VALUES (4, 'xyz'); -- failed @@ -80,6 +117,9 @@ INSERT INTO t4 VALUES (4, 'mno'); -- failed INSERT INTO t5 VALUES (1,2,3); -- failed INSERT INTO t5 (e,f) VALUES ('abc', 'def'); -- failed INSERT INTO t5 (e) VALUES ('abc'); -- ok +INSERT INTO t1p_tens (o,p) VALUES (99, 'pqr'); -- failed +INSERT INTO t1p_ones (o,p) VALUES (9, 'stu'); -- failed +INSERT INTO t1p_hunds (o,p) VALUES (999, 'stu'); -- ok UPDATE t1 SET b = b || '_upd'; -- ok UPDATE t2 SET y = y || '_upd'; -- failed @@ -88,6 +128,11 @@ UPDATE t4 SET n = n || '_upd'; -- failed UPDATE t5 SET e = 'xyz'; -- ok UPDATE t5 SET e = f || '_upd'; -- ok UPDATE t5 SET e = g || '_upd'; -- failed +UPDATE t1p SET o = 99; -- failed +UPDATE t1p SET o = 0; -- failed +UPDATE t1p SET o = 999; -- failed +UPDATE t1p_ones SET o = 9; -- failed +UPDATE t1p_hunds SET o = 900; -- ok DELETE FROM t1; -- ok DELETE FROM t2; -- failed @@ -96,6 +141,9 @@ DELETE FROM t4; -- failed DELETE FROM t5; -- ok DELETE FROM t5 WHERE f IS NULL; -- ok DELETE FROM t5 WHERE g IS NULL; -- failed +DELETE FROM t1p_ones WHERE o IS NULL; -- failed +DELETE FROM t1p_tens WHERE p IS NULL; -- failed +DELETE FROM t1p_hunds WHERE p IS NULL; -- ok -- -- COPY TO/FROM statements @@ -106,6 +154,9 @@ COPY t3 TO '/dev/null'; -- ok COPY t4 TO '/dev/null'; -- failed COPY t5 TO '/dev/null'; -- failed COPY t5(e,f) TO '/dev/null'; -- ok +COPY (SELECT * FROM t1p) TO '/dev/null'; -- failed +COPY t1p_ones TO '/dev/null'; -- ok +COPY t1p_tens TO '/dev/null'; -- failed COPY t1 FROM '/dev/null'; -- ok COPY t2 FROM '/dev/null'; -- failed @@ -132,6 +183,7 @@ DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; DROP TABLE IF EXISTS t5 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; DROP TABLE IF EXISTS customer CASCADE; DROP SCHEMA IF EXISTS my_schema_1 CASCADE; DROP SCHEMA IF EXISTS my_schema_2 CASCADE; diff --git a/contrib/sepgsql/sql/label.sql b/contrib/sepgsql/sql/label.sql index 49780b2..7809032 100644 --- a/contrib/sepgsql/sql/label.sql +++ b/contrib/sepgsql/sql/label.sql @@ -64,6 +64,22 @@ INSERT INTO var_tbl VALUES (2,'xxx'), (3,'yyy'), (4,'zzz'), (5,'xyz'); SECURITY LABEL ON TABLE var_tbl IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; +CREATE TABLE foo_ptbl(o int, p text) PARTITION BY RANGE (o); +CREATE TABLE foo_ptbl_ones PARTITION OF foo_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE foo_ptbl_tens PARTITION OF foo_ptbl FOR VALUES FROM ('10') TO ('100'); + +INSERT INTO foo_ptbl VALUES (0, 'aaa'), (9,'bbb'), (10,'ccc'), (99,'ddd'); +SECURITY LABEL ON TABLE foo_ptbl + IS 'system_u:object_r:sepgsql_regtest_foo_table_t:s0'; + +CREATE TABLE var_ptbl(q int, r text) PARTITION BY RANGE (q); +CREATE TABLE var_ptbl_ones PARTITION OF var_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE var_ptbl_tens PARTITION OF var_ptbl FOR VALUES FROM ('10') TO ('100'); + +INSERT INTO var_ptbl VALUES (0,'xxx'), (9,'yyy'), (10,'zzz'), (99,'xyz'); +SECURITY LABEL ON TABLE var_ptbl + IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; + -- -- Tests for default labeling behavior -- @@ -75,10 +91,30 @@ INSERT INTO t3 VALUES (1, 'sss'), (2, 'ttt'), (3, 'uuu'); CREATE TABLE t4 (m int, n text); INSERT INTO t4 VALUES (1,'mmm'), (2,'nnn'), (3,'ooo'); +-- @SECURITY-CONTEXT=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 +CREATE TABLE tpart (o int, p text) PARTITION BY RANGE (o); + +CREATE TABLE tpart_ones PARTITION OF tpart FOR VALUES FROM ('0') TO ('10'); +-- @SECURITY-CONTEXT=unconfined_u:unconfined_r:sepgsql_regtest_dba_t:s0 +CREATE TABLE tpart_tens PARTITION OF tpart FOR VALUES FROM ('10') TO ('100'); + +INSERT INTO tpart VALUES (0, 'aaa'); +INSERT INTO tpart VALUES (9, 'bbb'); +INSERT INTO tpart VALUES (99, 'ccc'); + SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3'); + WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3', + 'tpart', + 'tpart_ones', + 'tpart_tens') + ORDER BY objname ASC; SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' OR objname like 't4.%'); + WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' + OR objname like 't4.%' + OR objname like 'tpart.%' + OR objname like 'tpart_ones.%' + OR objname like 'tpart_tens.%') + ORDER BY objname ASC; -- -- Tests for SECURITY LABEL @@ -92,6 +128,14 @@ SECURITY LABEL ON COLUMN t2 IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- be failed SECURITY LABEL ON COLUMN t2.b IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'invalid security context'; -- be failed +SECURITY LABEL ON COLUMN tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- be failed +SECURITY LABEL ON COLUMN tpart.o + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok -- -- Tests for Trusted Procedures @@ -198,8 +242,10 @@ SELECT auth_func('foo', 'acbd18db4cc2f85cedef654fccc4a4d8'); SELECT sepgsql_getcon(); SELECT * FROM foo_tbl; -- OK +SELECT * FROM foo_ptbl; -- OK SELECT * FROM var_tbl; -- failed +SELECT * FROM var_ptbl; -- failed SELECT * FROM auth_tbl; -- failed @@ -208,8 +254,10 @@ SELECT sepgsql_getcon(); -- the pooler cannot touch these tables directly SELECT * FROM foo_tbl; -- failed +SELECT * FROM foo_ptbl; -- failed SELECT * FROM var_tbl; -- failed +SELECT * FROM var_ptbl; -- failed -- switch to "var" SELECT auth_func('var', 'b2145aac704ce76dbe1ac7adac535b23'); @@ -217,8 +265,10 @@ SELECT auth_func('var', 'b2145aac704ce76dbe1ac7adac535b23'); SELECT sepgsql_getcon(); SELECT * FROM foo_tbl; -- failed +SELECT * FROM foo_ptbl; -- failed SELECT * FROM var_tbl; -- OK +SELECT * FROM var_ptbl; -- OK SELECT * FROM auth_tbl; -- failed @@ -236,6 +286,7 @@ DROP TABLE IF EXISTS t1 CASCADE; DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; +DROP TABLE IF EXISTS tpart CASCADE; DROP FUNCTION IF EXISTS f1() CASCADE; DROP FUNCTION IF EXISTS f2() CASCADE; DROP FUNCTION IF EXISTS f3() CASCADE; diff --git a/contrib/sepgsql/sql/misc.sql b/contrib/sepgsql/sql/misc.sql index c277711..bd5b6e2 100644 --- a/contrib/sepgsql/sql/misc.sql +++ b/contrib/sepgsql/sql/misc.sql @@ -10,17 +10,31 @@ LOAD '$libdir/sepgsql'; -- failed CREATE TABLE t1 (x int, y text); INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(1,100) x); +CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +INSERT INTO t1p (SELECT x, md5(x::text) FROM generate_series(0,99) x); + SET sepgsql.debug_audit = on; SET client_min_messages = log; -- regular function and operators SELECT * FROM t1 WHERE x > 50 AND y like '%64%'; +SELECT * FROM t1p WHERE o > 50 AND p like '%64%'; +SELECT * FROM t1p_ones WHERE o > 50 AND p like '%64%'; +SELECT * FROM t1p_tens WHERE o > 50 AND p like '%64%'; -- aggregate function SELECT MIN(x), AVG(x) FROM t1; +SELECT MIN(o), AVG(o) FROM t1p; +SELECT MIN(o), AVG(o) FROM t1p_ones; +SELECT MIN(o), AVG(o) FROM t1p_tens; -- window function SELECT row_number() OVER (order by x), * FROM t1 WHERE y like '%86%'; +SELECT row_number() OVER (order by o), * FROM t1p WHERE p like '%86%'; +SELECT row_number() OVER (order by o), * FROM t1p_ones WHERE p like '%86%'; +SELECT row_number() OVER (order by o), * FROM t1p_tens WHERE p like '%86%'; RESET sepgsql.debug_audit; RESET client_min_messages; @@ -28,3 +42,4 @@ RESET client_min_messages; -- Cleanup -- DROP TABLE IF EXISTS t1 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; -- 1.8.3.1
^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
@ 2017-04-07 21:22                                                 ` Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-07 21:22 UTC (permalink / raw)
  To: Mike Palmiotto <mike.palmiotto@crunchydata.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Robert Haas <robertmhaas@gmail.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/07/2017 11:37 AM, Mike Palmiotto wrote:
>>> I found some missing bits in the 0002 patch -- new version attached.
>>> Will wait on new regression tests before committing, but I expect we'll
>>> have those by end of today and be able to commit the rest tomorrow.
>>
>> Attached are the regression test updates for partitioned tables.
> 
> Actually attached this time.

Based on my review and testing of the 0002 patch I believe it is
correct. However Mike and I just went through the regression test patch
line by line and there are issues he needs to address -- there is no way
that is happening by tonight as the output is very verbose and we need
to be sure we are both testing the correct things and getting the
correct behaviors.

Based on that I can:

1) commit the 0002 patch now before the feature freeze and follow up
   with the regression test patch when ready in a couple of days
2) hold off on both patches until ready
3) push both patches to the next commitfest/pg11

Some argue this is an open issue against the new partitioning feature in
pg10 and therefore should be addressed now, and others do not. I can see
both sides of that argument.

In any case, thoughts on what to do?

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-08 00:36                                                   ` Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Robert Haas @ 2017-04-08 00:36 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On Fri, Apr 7, 2017 at 5:22 PM, Joe Conway <mail@joeconway.com> wrote:
> On 04/07/2017 11:37 AM, Mike Palmiotto wrote:
>>>> I found some missing bits in the 0002 patch -- new version attached.
>>>> Will wait on new regression tests before committing, but I expect we'll
>>>> have those by end of today and be able to commit the rest tomorrow.
>>>
>>> Attached are the regression test updates for partitioned tables.
>>
>> Actually attached this time.
>
> Based on my review and testing of the 0002 patch I believe it is
> correct. However Mike and I just went through the regression test patch
> line by line and there are issues he needs to address -- there is no way
> that is happening by tonight as the output is very verbose and we need
> to be sure we are both testing the correct things and getting the
> correct behaviors.
>
> Based on that I can:
>
> 1) commit the 0002 patch now before the feature freeze and follow up
>    with the regression test patch when ready in a couple of days
> 2) hold off on both patches until ready
> 3) push both patches to the next commitfest/pg11
>
> Some argue this is an open issue against the new partitioning feature in
> pg10 and therefore should be addressed now, and others do not. I can see
> both sides of that argument.
>
> In any case, thoughts on what to do?

Speaking only for myself, I'm OK with any of those options, provided
that that "a couple" means what my dictionary says it means.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-04-08 02:36                                                     ` Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-08 02:36 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 04/07/2017 05:36 PM, Robert Haas wrote:
> On Fri, Apr 7, 2017 at 5:22 PM, Joe Conway <mail@joeconway.com> wrote:
>> 1) commit the 0002 patch now before the feature freeze and follow up
>>    with the regression test patch when ready in a couple of days
>> 2) hold off on both patches until ready
>> 3) push both patches to the next commitfest/pg11
>>
>> Some argue this is an open issue against the new partitioning feature in
>> pg10 and therefore should be addressed now, and others do not. I can see
>> both sides of that argument.
>>
>> In any case, thoughts on what to do?
> 
> Speaking only for myself, I'm OK with any of those options, provided
> that that "a couple" means what my dictionary says it means.

Thanks. I'd prefer not to do #1 actually, and I think we can adhere to
the dictionary meaning of "a couple" (i.e. by EOD Sunday). Assuming we
are ready by Sunday I will push both together (#2) or else I will move
them both together to the next CF (#3).

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-08 14:29                                                       ` Stephen Frost <sfrost@snowman.net>
  2017-04-09 17:18                                                         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 2 replies; 61+ messages in thread

From: Stephen Frost @ 2017-04-08 14:29 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

Joe,

* Joe Conway (mail@joeconway.com) wrote:
> On 04/07/2017 05:36 PM, Robert Haas wrote:
> > On Fri, Apr 7, 2017 at 5:22 PM, Joe Conway <mail@joeconway.com> wrote:
> >> 1) commit the 0002 patch now before the feature freeze and follow up
> >>    with the regression test patch when ready in a couple of days
> >> 2) hold off on both patches until ready
> >> 3) push both patches to the next commitfest/pg11
> >>
> >> Some argue this is an open issue against the new partitioning feature in
> >> pg10 and therefore should be addressed now, and others do not. I can see
> >> both sides of that argument.
> >>
> >> In any case, thoughts on what to do?
> > 
> > Speaking only for myself, I'm OK with any of those options, provided
> > that that "a couple" means what my dictionary says it means.
> 
> Thanks. I'd prefer not to do #1 actually, and I think we can adhere to
> the dictionary meaning of "a couple" (i.e. by EOD Sunday). Assuming we
> are ready by Sunday I will push both together (#2) or else I will move
> them both together to the next CF (#3).

Sounds good to me.

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
@ 2017-04-09 17:18                                                         ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
  1 sibling, 0 replies; 61+ messages in thread

From: Mike Palmiotto @ 2017-04-09 17:18 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; +Cc: Joe Conway <mail@joeconway.com>; Robert Haas <robertmhaas@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On Sat, Apr 8, 2017 at 10:29 AM, Stephen Frost <sfrost@snowman.net> wrote:
> Joe,
>
> * Joe Conway (mail@joeconway.com) wrote:
>> On 04/07/2017 05:36 PM, Robert Haas wrote:
>> > On Fri, Apr 7, 2017 at 5:22 PM, Joe Conway <mail@joeconway.com> wrote:
>> >> 1) commit the 0002 patch now before the feature freeze and follow up
>> >>    with the regression test patch when ready in a couple of days
>> >> 2) hold off on both patches until ready
>> >> 3) push both patches to the next commitfest/pg11
>> >>
>> >> Some argue this is an open issue against the new partitioning feature in
>> >> pg10 and therefore should be addressed now, and others do not. I can see
>> >> both sides of that argument.
>> >>
>> >> In any case, thoughts on what to do?
>> >
>> > Speaking only for myself, I'm OK with any of those options, provided
>> > that that "a couple" means what my dictionary says it means.
>>
>> Thanks. I'd prefer not to do #1 actually, and I think we can adhere to
>> the dictionary meaning of "a couple" (i.e. by EOD Sunday). Assuming we
>> are ready by Sunday I will push both together (#2) or else I will move
>> them both together to the next CF (#3).

Without further ado, the updated patch is attached.

I added some comment updates, making it clearer where partitioned
tables are used and modified the test-cases to be as close to
lock-step with regular table regression testing as possible.

Let me know if you find any further issues -- I made sure to review
pretty thoroughly, so I'd be surprised, but it happens.

Thanks,
-- 
Mike Palmiotto
Software Engineer
Crunchy Data Solutions
https://crunchydata.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

0001-Add-sepgsql-regression-tests-for-partitioned-tables.patch (text/x-patch, 138.0K) download From b4ee2ca50a75702d04d84d692fdcc309f98cb51c Mon Sep 17 00:00:00 2001 From: Mike Palmiotto <mike.palmiotto@crunchydata.com> Date: Fri, 7 Apr 2017 15:40:08 +0000 Subject: [PATCH] Add sepgsql regression tests for partitioned tables --- contrib/sepgsql/expected/alter.out | 112 +++++++++++++++- contrib/sepgsql/expected/ddl.out | 253 +++++++++++++++++++++++++++++++++++++ contrib/sepgsql/expected/dml.out | 210 +++++++++++++++++++++++++++--- contrib/sepgsql/expected/label.out | 157 +++++++++++++++++++---- contrib/sepgsql/expected/misc.out | 160 +++++++++++++++++++++++ contrib/sepgsql/sql/alter.sql | 65 ++++++++++ contrib/sepgsql/sql/ddl.sql | 27 ++++ contrib/sepgsql/sql/dml.sql | 122 +++++++++++++++++- contrib/sepgsql/sql/label.sql | 55 +++++++- contrib/sepgsql/sql/misc.sql | 15 +++ 10 files changed, 1126 insertions(+), 50 deletions(-) diff --git a/contrib/sepgsql/expected/alter.out b/contrib/sepgsql/expected/alter.out index cf554c9..0948139 100644 --- a/contrib/sepgsql/expected/alter.out +++ b/contrib/sepgsql/expected/alter.out @@ -26,6 +26,13 @@ SET search_path = regtest_schema_1, regtest_schema_2, public; CREATE TABLE regtest_table_1 (a int, b text); CREATE TABLE regtest_table_2 (c text) inherits (regtest_table_1); CREATE TABLE regtest_table_3 (x int primary key, y text); +--- +-- partitioned table parent +CREATE TABLE regtest_ptable_1 (o int, p text) PARTITION BY RANGE (o); +-- partitioned table children +CREATE TABLE regtest_ptable_1_ones PARTITION OF regtest_ptable_1 FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE regtest_ptable_1_tens PARTITION OF regtest_ptable_1 FOR VALUES FROM ('10') TO ('100'); +--- CREATE SEQUENCE regtest_seq_1; CREATE VIEW regtest_view_1 AS SELECT * FROM regtest_table_1 WHERE a > 0; CREATE FUNCTION regtest_func_1 (text) RETURNS bool @@ -54,6 +61,10 @@ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_table_1" ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user; LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_table_1" +ALTER TABLE regtest_ptable_1 OWNER TO regress_sepgsql_test_user; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1" +ALTER TABLE regtest_ptable_1_ones OWNER TO regress_sepgsql_test_user; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1_ones" ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema_1.regtest_seq_1" ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; @@ -73,6 +84,14 @@ ALTER TABLE regtest_table_1 SET SCHEMA regtest_schema_2; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_table_1" +ALTER TABLE regtest_ptable_1 SET SCHEMA regtest_schema_2; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1" +ALTER TABLE regtest_ptable_1_ones SET SCHEMA regtest_schema_2; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_1.regtest_ptable_1_ones" ALTER SEQUENCE regtest_seq_1 SET SCHEMA regtest_schema_2; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_1" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" @@ -97,6 +116,16 @@ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_1" +--- +-- partitioned table parent +ALTER TABLE regtest_ptable_1 RENAME TO regtest_ptable; +LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_ptable_1" +-- partitioned table child +ALTER TABLE regtest_ptable_1_ones RENAME TO regtest_table_part; +LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_ptable_1_ones" +--- ALTER SEQUENCE regtest_seq_1 RENAME TO regtest_seq; LOG: SELinux: allowed { add_name remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema_2" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema_2.regtest_seq_1" @@ -197,6 +226,83 @@ ALTER TABLE regtest_table_2 NO INHERIT regtest_table; -- not supported ALTER TABLE regtest_table_2 INHERIT regtest_table; -- not supported ALTER TABLE regtest_table SET TABLESPACE pg_default; LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table" +--- +-- partitioned table parent +ALTER TABLE regtest_ptable ADD COLUMN d float; +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: ALTER TABLE regtest_ptable ADD COLUMN d float; + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.d" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.d" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.d" +ALTER TABLE regtest_ptable DROP COLUMN d; +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.d" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.d" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.d" +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'abcd'; -- not supported by sepgsql +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'XYZ'; -- not supported by sepgsql +ALTER TABLE regtest_ptable ALTER p DROP DEFAULT; -- not supported by sepgsql +ALTER TABLE regtest_ptable ALTER p SET NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ALTER p DROP NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ALTER p SET STATISTICS -1; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ALTER p SET (n_distinct = 999); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +ALTER TABLE regtest_ptable ALTER p SET STORAGE PLAIN; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p" +ALTER TABLE regtest_ptable ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported by sepgsql +ALTER TABLE regtest_ptable DROP CONSTRAINT test_ck; -- not supported by sepgsql +ALTER TABLE regtest_ptable SET WITH OIDS; +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.oid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.oid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.oid" +ALTER TABLE regtest_ptable SET WITHOUT OIDS; +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.oid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.oid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.oid" +ALTER TABLE regtest_ptable SET TABLESPACE pg_default; +-- partitioned table child +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'abcd'; -- not supported by sepgsql +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'XYZ'; -- not supported by sepgsql +ALTER TABLE regtest_table_part ALTER p DROP DEFAULT; -- not supported by sepgsql +ALTER TABLE regtest_table_part ALTER p SET NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p DROP NOT NULL; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p SET STATISTICS -1; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p SET (n_distinct = 999); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ALTER p SET STORAGE PLAIN; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.p" +ALTER TABLE regtest_table_part ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported by sepgsql +ALTER TABLE regtest_table_part VALIDATE CONSTRAINT test_ck; -- not supported by sepgsql +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +ALTER TABLE regtest_table_part DROP CONSTRAINT test_ck; -- not supported by sepgsql +CREATE TRIGGER regtest_part_test_trig BEFORE UPDATE ON regtest_table_part + FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); +ALTER TABLE regtest_table_part DISABLE TRIGGER regtest_part_test_trig; -- not supported by sepgsql +ALTER TABLE regtest_table_part ENABLE TRIGGER regtest_part_test_trig; -- not supported by sepgsql +ALTER TABLE regtest_table_part SET (fillfactor = 75); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_part" +ALTER TABLE regtest_table_part RESET (fillfactor); +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_part" +ALTER TABLE regtest_table_part SET TABLESPACE pg_default; +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table_part" +--- ALTER VIEW regtest_view SET (security_barrier); LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema_2.regtest_view" ALTER SEQUENCE regtest_seq INCREMENT BY 10 START WITH 1000; @@ -208,13 +314,15 @@ RESET sepgsql.debug_audit; RESET client_min_messages; DROP DATABASE sepgsql_test_regression; DROP SCHEMA regtest_schema CASCADE; -NOTICE: drop cascades to 3 other objects +NOTICE: drop cascades to 4 other objects DETAIL: drop cascades to table regtest_table_2 drop cascades to table regtest_table_3 drop cascades to constraint test_fk on table regtest_table +drop cascades to table regtest_ptable_1_tens DROP SCHEMA regtest_schema_2 CASCADE; -NOTICE: drop cascades to 4 other objects +NOTICE: drop cascades to 5 other objects DETAIL: drop cascades to table regtest_table +drop cascades to table regtest_ptable drop cascades to sequence regtest_seq drop cascades to view regtest_view drop cascades to function regtest_func(text) diff --git a/contrib/sepgsql/expected/ddl.out b/contrib/sepgsql/expected/ddl.out index de820c8..7ad6903 100644 --- a/contrib/sepgsql/expected/ddl.out +++ b/contrib/sepgsql/expected/ddl.out @@ -76,14 +76,63 @@ LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.a" +CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" +CREATE TABLE regtest_ptable_ones PARTITION OF regtest_ptable FOR VALUES FROM ('0') TO ('10'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_ones" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.a" +CREATE TABLE regtest_ptable_tens PARTITION OF regtest_ptable FOR VALUES FROM ('10') TO ('100'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_tens" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.a" +ALTER TABLE regtest_ptable ADD COLUMN q int; +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: ALTER TABLE regtest_ptable ADD COLUMN q int; + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q" -- corresponding toast table should not have label and permission checks ALTER TABLE regtest_table_2 ADD COLUMN b text; LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.b" -- VACUUM FULL internally create a new table and swap them later. VACUUM FULL regtest_table; +VACUUM FULL regtest_ptable; CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view" +CREATE VIEW regtest_pview AS SELECT * FROM regtest_ptable WHERE a < 99; +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview" CREATE SEQUENCE regtest_seq; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_seq" @@ -132,9 +181,58 @@ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_reg LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" +CREATE TABLE regtest_ptable_3 (o int, p serial) PARTITION BY RANGE (o); +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable_3 (o int, p serial) PARTITION BY... + ^ +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.p" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" +CREATE TABLE regtest_ptable_3_ones PARTITION OF regtest_ptable_3 FOR VALUES FROM ('0') to ('10'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_ones" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.o" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.p" +CREATE TABLE regtest_ptable_3_tens PARTITION OF regtest_ptable_3 FOR VALUES FROM ('10') to ('100'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_tens" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.o" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.p" CREATE VIEW regtest_view_2 AS SELECT * FROM regtest_table_3 WHERE x < y; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view_2" +CREATE VIEW regtest_pview_2 AS SELECT * FROM regtest_ptable_3 WHERE o < p; +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview_2" CREATE FUNCTION regtest_func_2(int) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RETURN $1 * $1 < 100; END'; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" @@ -213,6 +311,92 @@ LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regte LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.y" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.z" +-- For partitioned tables +CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITION BY RANGE (x); +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITIO... + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITIO... + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LINE 1: CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITIO... + ^ +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.z" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" +CREATE TABLE regtest_ptable_4_ones PARTITION OF regtest_ptable_4 FOR VALUES FROM ('0') TO ('10'); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.tableoid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmax" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmin" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.ctid" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.x" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.y" +LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.z" +CREATE INDEX regtest_pindex_tbl4_y ON regtest_ptable_4_ones(y); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +CREATE INDEX regtest_pindex_tbl4_z ON regtest_ptable_4_ones(z); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +ALTER TABLE regtest_ptable_4 ALTER COLUMN y TYPE float; +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" +LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.y" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.float8(integer)" +DROP INDEX regtest_pindex_tbl4_y; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +ALTER TABLE regtest_ptable_4_ones + ADD CONSTRAINT regtest_ptbl4_con EXCLUDE USING btree (z WITH =); +LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +DROP TABLE regtest_ptable_4 CASCADE; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.x" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.y" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.z" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.z" -- -- DROP Permission checks (with clean-up) -- @@ -234,6 +418,13 @@ ALTER TABLE regtest_table DROP COLUMN y; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.y" ALTER TABLE regtest_table_2 SET WITHOUT OIDS; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid" +ALTER TABLE regtest_ptable DROP COLUMN q CASCADE; +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q" +NOTICE: drop cascades to view regtest_pview +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" DROP TABLE regtest_table; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" @@ -249,14 +440,76 @@ LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regte LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.z" +DROP TABLE regtest_ptable CASCADE; +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_tens" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.a" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_ones" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.a" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" DROP OWNED BY regress_sepgsql_test_user; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_func_2(integer)" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview_2" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view_2" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_tens" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.o" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.p" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_ones" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.o" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.p" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.tableoid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmax" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmin" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.ctid" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.p" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_3" diff --git a/contrib/sepgsql/expected/dml.out b/contrib/sepgsql/expected/dml.out index 8716ac7..e2d277c 100644 --- a/contrib/sepgsql/expected/dml.out +++ b/contrib/sepgsql/expected/dml.out @@ -21,6 +21,23 @@ SECURITY LABEL ON TABLE t5 IS 'system_u:object_r:sepgsql_table_t:s0'; SECURITY LABEL ON COLUMN t5.e IS 'system_u:object_r:sepgsql_table_t:s0'; SECURITY LABEL ON COLUMN t5.f IS 'system_u:object_r:sepgsql_ro_table_t:s0'; SECURITY LABEL ON COLUMN t5.g IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +--- +-- partitioned table parent +CREATE TABLE t1p (o int, p text, q text) PARTITION BY RANGE (o); +SECURITY LABEL ON TABLE t1p IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p.q IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +-- partitioned table children +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +SECURITY LABEL ON COLUMN t1p_ones.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.q IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +SECURITY LABEL ON COLUMN t1p_tens.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.q IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +--- CREATE TABLE customer (cid int primary key, cname text, ccredit text); SECURITY LABEL ON COLUMN customer.ccredit IS 'system_u:object_r:sepgsql_secret_table_t:s0'; INSERT INTO customer VALUES (1, 'Taro', '1111-2222-3333-4444'), @@ -33,24 +50,44 @@ SECURITY LABEL ON FUNCTION customer_credit(int) SELECT objtype, objname, label FROM pg_seclabels WHERE provider = 'selinux' AND objtype in ('table', 'column') - AND objname in ('t1', 't2', 't3', 't4', 't5', 't5.e', 't5.f', 't5.g') + AND objname in ('t1', 't2', 't3', 't4', + 't5', 't5.e', 't5.f', 't5.g', + 't1p', 't1p.o', 't1p.p', 't1p.q', + 't1p_ones', 't1p_ones.o', 't1p_ones.p', 't1p_ones.q', + 't1p_tens', 't1p_tens.o', 't1p_tens.p', 't1p_tens.q') ORDER BY objname; - objtype | objname | label ----------+---------+--------------------------------------------- - table | t1 | system_u:object_r:sepgsql_table_t:s0 - table | t2 | system_u:object_r:sepgsql_ro_table_t:s0 - table | t3 | system_u:object_r:sepgsql_fixed_table_t:s0 - table | t4 | system_u:object_r:sepgsql_secret_table_t:s0 - table | t5 | system_u:object_r:sepgsql_table_t:s0 - column | t5.e | system_u:object_r:sepgsql_table_t:s0 - column | t5.f | system_u:object_r:sepgsql_ro_table_t:s0 - column | t5.g | system_u:object_r:sepgsql_secret_table_t:s0 -(8 rows) + objtype | objname | label +---------+------------+--------------------------------------------- + table | t1 | system_u:object_r:sepgsql_table_t:s0 + table | t1p | system_u:object_r:sepgsql_table_t:s0 + column | t1p.o | system_u:object_r:sepgsql_table_t:s0 + table | t1p_ones | unconfined_u:object_r:sepgsql_table_t:s0 + column | t1p_ones.o | system_u:object_r:sepgsql_table_t:s0 + column | t1p_ones.p | system_u:object_r:sepgsql_ro_table_t:s0 + column | t1p_ones.q | system_u:object_r:sepgsql_secret_table_t:s0 + column | t1p.p | system_u:object_r:sepgsql_ro_table_t:s0 + column | t1p.q | system_u:object_r:sepgsql_secret_table_t:s0 + table | t1p_tens | unconfined_u:object_r:sepgsql_table_t:s0 + column | t1p_tens.o | system_u:object_r:sepgsql_table_t:s0 + column | t1p_tens.p | system_u:object_r:sepgsql_ro_table_t:s0 + column | t1p_tens.q | system_u:object_r:sepgsql_secret_table_t:s0 + table | t2 | system_u:object_r:sepgsql_ro_table_t:s0 + table | t3 | system_u:object_r:sepgsql_fixed_table_t:s0 + table | t4 | system_u:object_r:sepgsql_secret_table_t:s0 + table | t5 | system_u:object_r:sepgsql_table_t:s0 + column | t5.e | system_u:object_r:sepgsql_table_t:s0 + column | t5.f | system_u:object_r:sepgsql_ro_table_t:s0 + column | t5.g | system_u:object_r:sepgsql_secret_table_t:s0 +(20 rows) CREATE SCHEMA my_schema_1; CREATE TABLE my_schema_1.ts1 (a int, b text); +CREATE TABLE my_schema_1.pts1 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_1.pts1_ones PARTITION OF my_schema_1.pts1 FOR VALUES FROM ('0') to ('10'); CREATE SCHEMA my_schema_2; CREATE TABLE my_schema_2.ts2 (x int, y text); +CREATE TABLE my_schema_2.pts2 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_2.pts2_tens PARTITION OF my_schema_2.pts2 FOR VALUES FROM ('10') to ('100'); SECURITY LABEL ON SCHEMA my_schema_2 IS 'system_u:object_r:sepgsql_regtest_invisible_schema_t:s0'; -- Hardwired Rules @@ -99,7 +136,42 @@ SELECT e,f FROM t5; -- ok ---+--- (0 rows) -SELECT * FROM customer; -- failed +--- +-- partitioned table parent +SELECT * FROM t1p; -- failed +ERROR: SELinux: security policy violation +SELECT o,p FROM t1p; -- ok + o | p +---+--- +(0 rows) + +--partitioned table children +SELECT * FROM t1p_ones; -- failed +ERROR: SELinux: security policy violation +SELECT o FROM t1p_ones; -- ok + o +--- +(0 rows) + +SELECT o,p FROM t1p_ones; -- ok + o | p +---+--- +(0 rows) + +SELECT * FROM t1p_tens; -- failed +ERROR: SELinux: security policy violation +SELECT o FROM t1p_tens; -- ok + o +--- +(0 rows) + +SELECT o,p FROM t1p_tens; -- ok + o | p +---+--- +(0 rows) + +--- +SELECT * FROM customer; -- failed ERROR: SELinux: security policy violation SELECT cid, cname, customer_credit(cid) FROM customer; -- ok cid | cname | customer_credit @@ -108,7 +180,7 @@ SELECT cid, cname, customer_credit(cid) FROM customer; -- ok 2 | Hanako | 5555-6666-7777-???? (2 rows) -SELECT count(*) FROM t5; -- ok +SELECT count(*) FROM t5; -- ok count ------- 0 @@ -116,6 +188,34 @@ SELECT count(*) FROM t5; -- ok SELECT count(*) FROM t5 WHERE g IS NULL; -- failed ERROR: SELinux: security policy violation +--- +-- partitioned table parent +SELECT count(*) FROM t1p; -- ok + count +------- + 0 +(1 row) + +SELECT count(*) FROM t1p WHERE q IS NULL; -- failed +ERROR: SELinux: security policy violation +-- partitioned table children +SELECT count(*) FROM t1p_ones; -- ok + count +------- + 0 +(1 row) + +SELECT count(*) FROM t1p_ones WHERE q IS NULL; -- failed +ERROR: SELinux: security policy violation +SELECT count(*) FROM t1p_tens; -- ok + count +------- + 0 +(1 row) + +SELECT count(*) FROM t1p_tens WHERE q IS NULL; -- failed +ERROR: SELinux: security policy violation +--- INSERT INTO t1 VALUES (4, 'abc'); -- ok INSERT INTO t2 VALUES (4, 'xyz'); -- failed ERROR: SELinux: security policy violation @@ -127,6 +227,22 @@ ERROR: SELinux: security policy violation INSERT INTO t5 (e,f) VALUES ('abc', 'def'); -- failed ERROR: SELinux: security policy violation INSERT INTO t5 (e) VALUES ('abc'); -- ok +--- +-- partitioned table parent +INSERT INTO t1p (o,p) VALUES (9, 'mno'); -- failed +ERROR: SELinux: security policy violation +INSERT INTO t1p (o) VALUES (9); -- ok +INSERT INTO t1p (o,p) VALUES (99, 'pqr'); -- failed +ERROR: SELinux: security policy violation +INSERT INTO t1p (o) VALUES (99); -- ok +-- partitioned table children +INSERT INTO t1p_ones (o,p) VALUES (9, 'mno'); -- failed +ERROR: SELinux: security policy violation +INSERT INTO t1p_ones (o) VALUES (9); -- ok +INSERT INTO t1p_tens (o,p) VALUES (99, 'pqr'); -- failed +ERROR: SELinux: security policy violation +INSERT INTO t1p_tens (o) VALUES (99); -- ok +--- UPDATE t1 SET b = b || '_upd'; -- ok UPDATE t2 SET y = y || '_upd'; -- failed ERROR: SELinux: security policy violation @@ -138,6 +254,23 @@ UPDATE t5 SET e = 'xyz'; -- ok UPDATE t5 SET e = f || '_upd'; -- ok UPDATE t5 SET e = g || '_upd'; -- failed ERROR: SELinux: security policy violation +--- +-- partitioned table parent +UPDATE t1p SET o = 9 WHERE o < 10; -- ok +UPDATE t1p SET o = 99 WHERE o >= 10; -- ok +UPDATE t1p SET o = ascii(COALESCE(p,'upd'))%10 WHERE o < 10; -- ok +UPDATE t1p SET o = ascii(COALESCE(q,'upd'))%100 WHERE o >= 10; -- failed +ERROR: SELinux: security policy violation +-- partitioned table children +UPDATE t1p_ones SET o = 9; -- ok +UPDATE t1p_ones SET o = ascii(COALESCE(p,'upd'))%10; -- ok +UPDATE t1p_ones SET o = ascii(COALESCE(q,'upd'))%10; -- failed +ERROR: SELinux: security policy violation +UPDATE t1p_tens SET o = 99; -- ok +UPDATE t1p_tens SET o = ascii(COALESCE(p,'upd'))%100; -- ok +UPDATE t1p_tens SET o = ascii(COALESCE(q,'upd'))%100; -- failed +ERROR: SELinux: security policy violation +--- DELETE FROM t1; -- ok DELETE FROM t2; -- failed ERROR: SELinux: security policy violation @@ -149,6 +282,20 @@ DELETE FROM t5; -- ok DELETE FROM t5 WHERE f IS NULL; -- ok DELETE FROM t5 WHERE g IS NULL; -- failed ERROR: SELinux: security policy violation +--- +-- partitioned table parent +DELETE FROM t1p; -- ok +DELETE FROM t1p WHERE p IS NULL; -- ok +DELETE FROM t1p WHERE q IS NULL; -- failed +ERROR: SELinux: security policy violation +-- partitioned table children +DELETE FROM t1p_ones WHERE p IS NULL; -- ok +DELETE FROM t1p_ones WHERE q IS NULL; -- failed; +ERROR: SELinux: security policy violation +DELETE FROM t1p_tens WHERE p IS NULL; -- ok +DELETE FROM t1p_tens WHERE q IS NULL; -- failed +ERROR: SELinux: security policy violation +--- -- -- COPY TO/FROM statements -- @@ -160,6 +307,19 @@ ERROR: SELinux: security policy violation COPY t5 TO '/dev/null'; -- failed ERROR: SELinux: security policy violation COPY t5(e,f) TO '/dev/null'; -- ok +--- +-- partitioned table parent +COPY (SELECT * FROM t1p) TO '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY (SELECT (o,p) FROM t1p) TO '/dev/null'; -- ok +-- partitioned table children +COPY t1p_ones TO '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY t1p_ones(o,p) TO '/dev/null'; -- ok +COPY t1p_tens TO '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY t1p_tens(o,p) TO '/dev/null'; -- ok +--- COPY t1 FROM '/dev/null'; -- ok COPY t2 FROM '/dev/null'; -- failed ERROR: SELinux: security policy violation @@ -171,6 +331,19 @@ ERROR: SELinux: security policy violation COPY t5 (e,f) FROM '/dev/null'; -- failed ERROR: SELinux: security policy violation COPY t5 (e) FROM '/dev/null'; -- ok +--- +-- partitioned table parent +COPY t1p FROM '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY t1p (o) FROM '/dev/null'; -- ok +-- partitioned table children +COPY t1p_ones FROM '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY t1p_ones (o) FROM '/dev/null'; -- ok +COPY t1p_tens FROM '/dev/null'; -- failed +ERROR: SELinux: security policy violation +COPY t1p_tens (o) FROM '/dev/null'; -- ok +--- -- -- Schema search path -- @@ -202,8 +375,13 @@ DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; DROP TABLE IF EXISTS t5 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; DROP TABLE IF EXISTS customer CASCADE; DROP SCHEMA IF EXISTS my_schema_1 CASCADE; -NOTICE: drop cascades to table my_schema_1.ts1 +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table my_schema_1.ts1 +drop cascades to table my_schema_1.pts1 DROP SCHEMA IF EXISTS my_schema_2 CASCADE; -NOTICE: drop cascades to table my_schema_2.ts2 +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table my_schema_2.ts2 +drop cascades to table my_schema_2.pts2 diff --git a/contrib/sepgsql/expected/label.out b/contrib/sepgsql/expected/label.out index 638e138..d34df11 100644 --- a/contrib/sepgsql/expected/label.out +++ b/contrib/sepgsql/expected/label.out @@ -53,6 +53,18 @@ CREATE TABLE var_tbl(x int, y text); INSERT INTO var_tbl VALUES (2,'xxx'), (3,'yyy'), (4,'zzz'), (5,'xyz'); SECURITY LABEL ON TABLE var_tbl IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; +CREATE TABLE foo_ptbl(o int, p text) PARTITION BY RANGE (o); +CREATE TABLE foo_ptbl_ones PARTITION OF foo_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE foo_ptbl_tens PARTITION OF foo_ptbl FOR VALUES FROM ('10') TO ('100'); +INSERT INTO foo_ptbl VALUES (0, 'aaa'), (9,'bbb'), (10,'ccc'), (99,'ddd'); +SECURITY LABEL ON TABLE foo_ptbl + IS 'system_u:object_r:sepgsql_regtest_foo_table_t:s0'; +CREATE TABLE var_ptbl(q int, r text) PARTITION BY RANGE (q); +CREATE TABLE var_ptbl_ones PARTITION OF var_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE var_ptbl_tens PARTITION OF var_ptbl FOR VALUES FROM ('10') TO ('100'); +INSERT INTO var_ptbl VALUES (0,'xxx'), (9,'yyy'), (10,'zzz'), (99,'xyz'); +SECURITY LABEL ON TABLE var_ptbl + IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; -- -- Tests for default labeling behavior -- @@ -72,36 +84,90 @@ SELECT sepgsql_getcon(); -- confirm client privilege CREATE TABLE t4 (m int, n text); INSERT INTO t4 VALUES (1,'mmm'), (2,'nnn'), (3,'ooo'); +SELECT sepgsql_getcon(); -- confirm client privilege + sepgsql_getcon +----------------------------------------------------- + unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 +(1 row) + +CREATE TABLE tpart (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE tpart_ones PARTITION OF tpart FOR VALUES FROM ('0') TO ('10'); +SELECT sepgsql_getcon(); -- confirm client privilege + sepgsql_getcon +---------------------------------------------------- + unconfined_u:unconfined_r:sepgsql_regtest_dba_t:s0 +(1 row) + +CREATE TABLE tpart_tens PARTITION OF tpart FOR VALUES FROM ('10') TO ('100'); +INSERT INTO tpart VALUES (0, 'aaa'); +INSERT INTO tpart VALUES (9, 'bbb'); +INSERT INTO tpart VALUES (99, 'ccc'); SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3'); - objtype | objname | label ----------+---------+----------------------------------------------- - table | t1 | unconfined_u:object_r:sepgsql_table_t:s0 - table | t2 | unconfined_u:object_r:sepgsql_table_t:s0 - table | t3 | unconfined_u:object_r:user_sepgsql_table_t:s0 -(3 rows) + WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3', + 'tpart', + 'tpart_ones', + 'tpart_tens') + ORDER BY objname ASC; + objtype | objname | label +---------+------------+----------------------------------------------- + table | t1 | unconfined_u:object_r:sepgsql_table_t:s0 + table | t2 | unconfined_u:object_r:sepgsql_table_t:s0 + table | t3 | unconfined_u:object_r:user_sepgsql_table_t:s0 + table | tpart | unconfined_u:object_r:user_sepgsql_table_t:s0 + table | tpart_ones | unconfined_u:object_r:user_sepgsql_table_t:s0 + table | tpart_tens | unconfined_u:object_r:sepgsql_table_t:s0 +(6 rows) SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' OR objname like 't4.%'); - objtype | objname | label ----------+-------------+----------------------------------------------- - column | t3.t | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.s | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t3.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 - column | t4.n | unconfined_u:object_r:sepgsql_table_t:s0 - column | t4.m | unconfined_u:object_r:sepgsql_table_t:s0 - column | t4.ctid | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.xmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.cmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.xmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.cmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 - column | t4.tableoid | unconfined_u:object_r:sepgsql_sysobj_t:s0 -(16 rows) + WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' + OR objname like 't4.%' + OR objname like 'tpart.%' + OR objname like 'tpart_ones.%' + OR objname like 'tpart_tens.%') + ORDER BY objname ASC; + objtype | objname | label +---------+---------------------+----------------------------------------------- + column | t3.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.s | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.t | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t3.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | t4.cmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.cmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.ctid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.m | unconfined_u:object_r:sepgsql_table_t:s0 + column | t4.n | unconfined_u:object_r:sepgsql_table_t:s0 + column | t4.tableoid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.xmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | t4.xmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.o | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.cmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.cmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.ctid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.o | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.p | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_ones.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.p | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.tableoid | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart_tens.cmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.cmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.ctid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.o | unconfined_u:object_r:sepgsql_table_t:s0 + column | tpart_tens.p | unconfined_u:object_r:sepgsql_table_t:s0 + column | tpart_tens.tableoid | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.xmax | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart_tens.xmin | unconfined_u:object_r:sepgsql_sysobj_t:s0 + column | tpart.xmax | unconfined_u:object_r:user_sepgsql_table_t:s0 + column | tpart.xmin | unconfined_u:object_r:user_sepgsql_table_t:s0 +(40 rows) -- -- Tests for SECURITY LABEL @@ -122,6 +188,16 @@ SECURITY LABEL ON COLUMN t2 ERROR: column name must be qualified SECURITY LABEL ON COLUMN t2.b IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'invalid security context'; -- be failed +ERROR: SELinux: invalid security label: "invalid security context" +SECURITY LABEL ON COLUMN tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- be failed +ERROR: column name must be qualified +SECURITY LABEL ON COLUMN tpart.o + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok -- -- Tests for Trusted Procedures -- @@ -422,8 +498,19 @@ SELECT * FROM foo_tbl; -- OK 4 | ddd (4 rows) +SELECT * FROM foo_ptbl; -- OK + o | p +----+----- + 0 | aaa + 9 | bbb + 10 | ccc + 99 | ddd +(4 rows) + SELECT * FROM var_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM var_ptbl; -- failed +ERROR: SELinux: security policy violation SELECT * FROM auth_tbl; -- failed ERROR: SELinux: security policy violation SELECT sepgsql_setcon(NULL); -- end of session @@ -441,8 +528,12 @@ SELECT sepgsql_getcon(); -- the pooler cannot touch these tables directly SELECT * FROM foo_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM foo_ptbl; -- failed +ERROR: SELinux: security policy violation SELECT * FROM var_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM var_ptbl; -- failed +ERROR: SELinux: security policy violation -- switch to "var" SELECT auth_func('var', 'b2145aac704ce76dbe1ac7adac535b23'); auth_func @@ -458,6 +549,8 @@ SELECT sepgsql_getcon(); SELECT * FROM foo_tbl; -- failed ERROR: SELinux: security policy violation +SELECT * FROM foo_ptbl; -- failed +ERROR: SELinux: security policy violation SELECT * FROM var_tbl; -- OK x | y ---+----- @@ -467,6 +560,15 @@ SELECT * FROM var_tbl; -- OK 5 | xyz (4 rows) +SELECT * FROM var_ptbl; -- OK + q | r +----+----- + 0 | xxx + 9 | yyy + 10 | zzz + 99 | xyz +(4 rows) + SELECT * FROM auth_tbl; -- failed ERROR: SELinux: security policy violation SELECT sepgsql_setcon(NULL); -- end of session @@ -501,6 +603,7 @@ DROP TABLE IF EXISTS t1 CASCADE; DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; +DROP TABLE IF EXISTS tpart CASCADE; DROP FUNCTION IF EXISTS f1() CASCADE; DROP FUNCTION IF EXISTS f2() CASCADE; DROP FUNCTION IF EXISTS f3() CASCADE; diff --git a/contrib/sepgsql/expected/misc.out b/contrib/sepgsql/expected/misc.out index f877e7b..7b55142 100644 --- a/contrib/sepgsql/expected/misc.out +++ b/contrib/sepgsql/expected/misc.out @@ -8,6 +8,10 @@ ERROR: SELinux: LOAD is not permitted -- CREATE TABLE t1 (x int, y text); INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(1,100) x); +CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +INSERT INTO t1p (SELECT x, md5(x::text) FROM generate_series(0,99) x); SET sepgsql.debug_audit = on; SET client_min_messages = log; -- regular function and operators @@ -27,6 +31,57 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re 100 | f899139df5e1059396431415e770c6dd (6 rows) +SELECT * FROM t1p WHERE o > 50 AND p like '%64%'; +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4eq(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4le(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4eq(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4le(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4le(integer,integer)" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4gt(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" + o | p +----+---------------------------------- + 77 | 28dd2c7955ce926456240b2ff0100bde + 89 | 7647966b7343c29048673252e490f736 + 90 | 8613985ec49eb8f757ae6439e879bb2a + 91 | 54229abfcfa5649e7003b83dd4755294 + 99 | ac627ab1ccbdb62ec96e702f07f6425b +(5 rows) + +SELECT * FROM t1p_ones WHERE o > 50 AND p like '%64%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4gt(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" + o | p +---+--- +(0 rows) + +SELECT * FROM t1p_tens WHERE o > 50 AND p like '%64%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4gt(integer,integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" + o | p +----+---------------------------------- + 77 | 28dd2c7955ce926456240b2ff0100bde + 89 | 7647966b7343c29048673252e490f736 + 90 | 8613985ec49eb8f757ae6439e879bb2a + 91 | 54229abfcfa5649e7003b83dd4755294 + 99 | ac627ab1ccbdb62ec96e702f07f6425b +(5 rows) + -- aggregate function SELECT MIN(x), AVG(x) FROM t1; LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1" @@ -41,6 +96,49 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re 1 | 50.5000000000000000 (1 row) +SELECT MIN(o), AVG(o) FROM t1p; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.avg(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4_avg_accum(bigint[],integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int8_avg(bigint[])" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.min(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4smaller(integer,integer)" + min | avg +-----+--------------------- + 0 | 49.5000000000000000 +(1 row) + +SELECT MIN(o), AVG(o) FROM t1p_ones; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.avg(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4_avg_accum(bigint[],integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int8_avg(bigint[])" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.min(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4smaller(integer,integer)" + min | avg +-----+-------------------- + 0 | 4.5000000000000000 +(1 row) + +SELECT MIN(o), AVG(o) FROM t1p_tens; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.avg(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4_avg_accum(bigint[],integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int8_avg(bigint[])" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.min(integer)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.int4smaller(integer,integer)" + min | avg +-----+--------------------- + 10 | 54.5000000000000000 +(1 row) + -- window function SELECT row_number() OVER (order by x), * FROM t1 WHERE y like '%86%'; LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1" @@ -64,9 +162,71 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re 12 | 94 | f4b9ec30ad9f68f89b29639786cb62ef (12 rows) +SELECT row_number() OVER (order by o), * FROM t1p WHERE p like '%86%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.row_number()" + row_number | o | p +------------+----+---------------------------------- + 1 | 2 | c81e728d9d4c2f636f067f89cc14862c + 2 | 17 | 70efdf2ec9b086079795c442636b55fb + 3 | 22 | b6d767d2f8ed5d21a44b0e5886680cb9 + 4 | 27 | 02e74f10e0327ad868d138f2b4fdd6f0 + 5 | 33 | 182be0c5cdcd5072bb1864cdee4d3d6e + 6 | 43 | 17e62166fc8586dfa4d1bc0e1742c08b + 7 | 54 | a684eceee76fc522773286a895bc8436 + 8 | 73 | d2ddea18f00665ce8623e36bd4e3c7c5 + 9 | 76 | fbd7939d674997cdb4692d34de8633c4 + 10 | 89 | 7647966b7343c29048673252e490f736 + 11 | 90 | 8613985ec49eb8f757ae6439e879bb2a + 12 | 94 | f4b9ec30ad9f68f89b29639786cb62ef +(12 rows) + +SELECT row_number() OVER (order by o), * FROM t1p_ones WHERE p like '%86%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_ones" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_ones column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.row_number()" + row_number | o | p +------------+---+---------------------------------- + 1 | 2 | c81e728d9d4c2f636f067f89cc14862c +(1 row) + +SELECT row_number() OVER (order by o), * FROM t1p_tens WHERE p like '%86%'; +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="public.t1p_tens" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column o" +LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table t1p_tens column p" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.textlike(pg_catalog.text,pg_catalog.text)" +LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0-s0:c0.c255 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.row_number()" + row_number | o | p +------------+----+---------------------------------- + 1 | 17 | 70efdf2ec9b086079795c442636b55fb + 2 | 22 | b6d767d2f8ed5d21a44b0e5886680cb9 + 3 | 27 | 02e74f10e0327ad868d138f2b4fdd6f0 + 4 | 33 | 182be0c5cdcd5072bb1864cdee4d3d6e + 5 | 43 | 17e62166fc8586dfa4d1bc0e1742c08b + 6 | 54 | a684eceee76fc522773286a895bc8436 + 7 | 73 | d2ddea18f00665ce8623e36bd4e3c7c5 + 8 | 76 | fbd7939d674997cdb4692d34de8633c4 + 9 | 89 | 7647966b7343c29048673252e490f736 + 10 | 90 | 8613985ec49eb8f757ae6439e879bb2a + 11 | 94 | f4b9ec30ad9f68f89b29639786cb62ef +(11 rows) + RESET sepgsql.debug_audit; RESET client_min_messages; -- -- Cleanup -- DROP TABLE IF EXISTS t1 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; diff --git a/contrib/sepgsql/sql/alter.sql b/contrib/sepgsql/sql/alter.sql index 0bd3527..14000ea 100644 --- a/contrib/sepgsql/sql/alter.sql +++ b/contrib/sepgsql/sql/alter.sql @@ -32,6 +32,15 @@ CREATE TABLE regtest_table_2 (c text) inherits (regtest_table_1); CREATE TABLE regtest_table_3 (x int primary key, y text); +--- +-- partitioned table parent +CREATE TABLE regtest_ptable_1 (o int, p text) PARTITION BY RANGE (o); + +-- partitioned table children +CREATE TABLE regtest_ptable_1_ones PARTITION OF regtest_ptable_1 FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE regtest_ptable_1_tens PARTITION OF regtest_ptable_1 FOR VALUES FROM ('10') TO ('100'); +--- + CREATE SEQUENCE regtest_seq_1; CREATE VIEW regtest_view_1 AS SELECT * FROM regtest_table_1 WHERE a > 0; @@ -55,6 +64,8 @@ ALTER SCHEMA regtest_schema_1 OWNER TO regress_sepgsql_test_user; ALTER SCHEMA regtest_schema_1 OWNER TO regress_sepgsql_test_user; ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user; ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user; +ALTER TABLE regtest_ptable_1 OWNER TO regress_sepgsql_test_user; +ALTER TABLE regtest_ptable_1_ones OWNER TO regress_sepgsql_test_user; ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user; ALTER VIEW regtest_view_1 OWNER TO regress_sepgsql_test_user; @@ -66,6 +77,8 @@ ALTER FUNCTION regtest_func_1(text) OWNER TO regress_sepgsql_test_user; -- ALTER xxx SET SCHEMA -- ALTER TABLE regtest_table_1 SET SCHEMA regtest_schema_2; +ALTER TABLE regtest_ptable_1 SET SCHEMA regtest_schema_2; +ALTER TABLE regtest_ptable_1_ones SET SCHEMA regtest_schema_2; ALTER SEQUENCE regtest_seq_1 SET SCHEMA regtest_schema_2; ALTER VIEW regtest_view_1 SET SCHEMA regtest_schema_2; ALTER FUNCTION regtest_func_1(text) SET SCHEMA regtest_schema_2; @@ -76,6 +89,14 @@ ALTER FUNCTION regtest_func_1(text) SET SCHEMA regtest_schema_2; ALTER DATABASE sepgsql_test_regression_1 RENAME TO sepgsql_test_regression; ALTER SCHEMA regtest_schema_1 RENAME TO regtest_schema; ALTER TABLE regtest_table_1 RENAME TO regtest_table; + +--- +-- partitioned table parent +ALTER TABLE regtest_ptable_1 RENAME TO regtest_ptable; +-- partitioned table child +ALTER TABLE regtest_ptable_1_ones RENAME TO regtest_table_part; +--- + ALTER SEQUENCE regtest_seq_1 RENAME TO regtest_seq; ALTER VIEW regtest_view_1 RENAME TO regtest_view; ALTER FUNCTION regtest_func_1(text) RENAME TO regtest_func; @@ -121,6 +142,50 @@ ALTER TABLE regtest_table_2 NO INHERIT regtest_table; -- not supported ALTER TABLE regtest_table_2 INHERIT regtest_table; -- not supported ALTER TABLE regtest_table SET TABLESPACE pg_default; +--- +-- partitioned table parent +ALTER TABLE regtest_ptable ADD COLUMN d float; +ALTER TABLE regtest_ptable DROP COLUMN d; +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'abcd'; -- not supported by sepgsql +ALTER TABLE regtest_ptable ALTER p SET DEFAULT 'XYZ'; -- not supported by sepgsql +ALTER TABLE regtest_ptable ALTER p DROP DEFAULT; -- not supported by sepgsql +ALTER TABLE regtest_ptable ALTER p SET NOT NULL; +ALTER TABLE regtest_ptable ALTER p DROP NOT NULL; +ALTER TABLE regtest_ptable ALTER p SET STATISTICS -1; +ALTER TABLE regtest_ptable ALTER p SET (n_distinct = 999); +ALTER TABLE regtest_ptable ALTER p SET STORAGE PLAIN; +ALTER TABLE regtest_ptable ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported by sepgsql +ALTER TABLE regtest_ptable DROP CONSTRAINT test_ck; -- not supported by sepgsql + +ALTER TABLE regtest_ptable SET WITH OIDS; +ALTER TABLE regtest_ptable SET WITHOUT OIDS; +ALTER TABLE regtest_ptable SET TABLESPACE pg_default; + +-- partitioned table child +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'abcd'; -- not supported by sepgsql +ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'XYZ'; -- not supported by sepgsql +ALTER TABLE regtest_table_part ALTER p DROP DEFAULT; -- not supported by sepgsql +ALTER TABLE regtest_table_part ALTER p SET NOT NULL; +ALTER TABLE regtest_table_part ALTER p DROP NOT NULL; +ALTER TABLE regtest_table_part ALTER p SET STATISTICS -1; +ALTER TABLE regtest_table_part ALTER p SET (n_distinct = 999); +ALTER TABLE regtest_table_part ALTER p SET STORAGE PLAIN; +ALTER TABLE regtest_table_part ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported by sepgsql +ALTER TABLE regtest_table_part VALIDATE CONSTRAINT test_ck; -- not supported by sepgsql +ALTER TABLE regtest_table_part DROP CONSTRAINT test_ck; -- not supported by sepgsql + +CREATE TRIGGER regtest_part_test_trig BEFORE UPDATE ON regtest_table_part + FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); + +ALTER TABLE regtest_table_part DISABLE TRIGGER regtest_part_test_trig; -- not supported by sepgsql +ALTER TABLE regtest_table_part ENABLE TRIGGER regtest_part_test_trig; -- not supported by sepgsql + +ALTER TABLE regtest_table_part SET (fillfactor = 75); +ALTER TABLE regtest_table_part RESET (fillfactor); + +ALTER TABLE regtest_table_part SET TABLESPACE pg_default; +--- + ALTER VIEW regtest_view SET (security_barrier); ALTER SEQUENCE regtest_seq INCREMENT BY 10 START WITH 1000; diff --git a/contrib/sepgsql/sql/ddl.sql b/contrib/sepgsql/sql/ddl.sql index 2fc66e4..ae431f6 100644 --- a/contrib/sepgsql/sql/ddl.sql +++ b/contrib/sepgsql/sql/ddl.sql @@ -32,13 +32,21 @@ ALTER TABLE regtest_table ADD COLUMN z int; CREATE TABLE regtest_table_2 (a int) WITH OIDS; +CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); +CREATE TABLE regtest_ptable_ones PARTITION OF regtest_ptable FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE regtest_ptable_tens PARTITION OF regtest_ptable FOR VALUES FROM ('10') TO ('100'); + +ALTER TABLE regtest_ptable ADD COLUMN q int; + -- corresponding toast table should not have label and permission checks ALTER TABLE regtest_table_2 ADD COLUMN b text; -- VACUUM FULL internally create a new table and swap them later. VACUUM FULL regtest_table; +VACUUM FULL regtest_ptable; CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; +CREATE VIEW regtest_pview AS SELECT * FROM regtest_ptable WHERE a < 99; CREATE SEQUENCE regtest_seq; @@ -57,8 +65,12 @@ SET SESSION AUTHORIZATION regress_sepgsql_test_user; SET search_path = regtest_schema, public; CREATE TABLE regtest_table_3 (x int, y serial); +CREATE TABLE regtest_ptable_3 (o int, p serial) PARTITION BY RANGE (o); +CREATE TABLE regtest_ptable_3_ones PARTITION OF regtest_ptable_3 FOR VALUES FROM ('0') to ('10'); +CREATE TABLE regtest_ptable_3_tens PARTITION OF regtest_ptable_3 FOR VALUES FROM ('10') to ('100'); CREATE VIEW regtest_view_2 AS SELECT * FROM regtest_table_3 WHERE x < y; +CREATE VIEW regtest_pview_2 AS SELECT * FROM regtest_ptable_3 WHERE o < p; CREATE FUNCTION regtest_func_2(int) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RETURN $1 * $1 < 100; END'; @@ -77,6 +89,18 @@ ALTER TABLE regtest_table_4 ADD CONSTRAINT regtest_tbl4_con EXCLUDE USING btree (z WITH =); DROP TABLE regtest_table_4 CASCADE; +-- For partitioned tables +CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITION BY RANGE (x); +CREATE TABLE regtest_ptable_4_ones PARTITION OF regtest_ptable_4 FOR VALUES FROM ('0') TO ('10'); + +CREATE INDEX regtest_pindex_tbl4_y ON regtest_ptable_4_ones(y); +CREATE INDEX regtest_pindex_tbl4_z ON regtest_ptable_4_ones(z); +ALTER TABLE regtest_ptable_4 ALTER COLUMN y TYPE float; +DROP INDEX regtest_pindex_tbl4_y; +ALTER TABLE regtest_ptable_4_ones + ADD CONSTRAINT regtest_ptbl4_con EXCLUDE USING btree (z WITH =); +DROP TABLE regtest_ptable_4 CASCADE; + -- -- DROP Permission checks (with clean-up) -- @@ -90,7 +114,10 @@ DROP VIEW regtest_view; ALTER TABLE regtest_table DROP COLUMN y; ALTER TABLE regtest_table_2 SET WITHOUT OIDS; +ALTER TABLE regtest_ptable DROP COLUMN q CASCADE; + DROP TABLE regtest_table; +DROP TABLE regtest_ptable CASCADE; DROP OWNED BY regress_sepgsql_test_user; diff --git a/contrib/sepgsql/sql/dml.sql b/contrib/sepgsql/sql/dml.sql index 7a64b9e..8e8e818 100644 --- a/contrib/sepgsql/sql/dml.sql +++ b/contrib/sepgsql/sql/dml.sql @@ -27,6 +27,26 @@ SECURITY LABEL ON COLUMN t5.e IS 'system_u:object_r:sepgsql_table_t:s0'; SECURITY LABEL ON COLUMN t5.f IS 'system_u:object_r:sepgsql_ro_table_t:s0'; SECURITY LABEL ON COLUMN t5.g IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +--- +-- partitioned table parent +CREATE TABLE t1p (o int, p text, q text) PARTITION BY RANGE (o); +SECURITY LABEL ON TABLE t1p IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p.q IS 'system_u:object_r:sepgsql_secret_table_t:s0'; + +-- partitioned table children +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +SECURITY LABEL ON COLUMN t1p_ones.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_ones.q IS 'system_u:object_r:sepgsql_secret_table_t:s0'; +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +SECURITY LABEL ON COLUMN t1p_tens.o IS 'system_u:object_r:sepgsql_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.p IS 'system_u:object_r:sepgsql_ro_table_t:s0'; +SECURITY LABEL ON COLUMN t1p_tens.q IS 'system_u:object_r:sepgsql_secret_table_t:s0'; + +--- + CREATE TABLE customer (cid int primary key, cname text, ccredit text); SECURITY LABEL ON COLUMN customer.ccredit IS 'system_u:object_r:sepgsql_secret_table_t:s0'; INSERT INTO customer VALUES (1, 'Taro', '1111-2222-3333-4444'), @@ -40,13 +60,22 @@ SECURITY LABEL ON FUNCTION customer_credit(int) SELECT objtype, objname, label FROM pg_seclabels WHERE provider = 'selinux' AND objtype in ('table', 'column') - AND objname in ('t1', 't2', 't3', 't4', 't5', 't5.e', 't5.f', 't5.g') + AND objname in ('t1', 't2', 't3', 't4', + 't5', 't5.e', 't5.f', 't5.g', + 't1p', 't1p.o', 't1p.p', 't1p.q', + 't1p_ones', 't1p_ones.o', 't1p_ones.p', 't1p_ones.q', + 't1p_tens', 't1p_tens.o', 't1p_tens.p', 't1p_tens.q') ORDER BY objname; CREATE SCHEMA my_schema_1; CREATE TABLE my_schema_1.ts1 (a int, b text); +CREATE TABLE my_schema_1.pts1 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_1.pts1_ones PARTITION OF my_schema_1.pts1 FOR VALUES FROM ('0') to ('10'); + CREATE SCHEMA my_schema_2; CREATE TABLE my_schema_2.ts2 (x int, y text); +CREATE TABLE my_schema_2.pts2 (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE my_schema_2.pts2_tens PARTITION OF my_schema_2.pts2 FOR VALUES FROM ('10') to ('100'); SECURITY LABEL ON SCHEMA my_schema_2 IS 'system_u:object_r:sepgsql_regtest_invisible_schema_t:s0'; @@ -67,12 +96,36 @@ SELECT * FROM t4; -- failed SELECT * FROM t5; -- failed SELECT e,f FROM t5; -- ok -SELECT * FROM customer; -- failed +--- +-- partitioned table parent +SELECT * FROM t1p; -- failed +SELECT o,p FROM t1p; -- ok +--partitioned table children +SELECT * FROM t1p_ones; -- failed +SELECT o FROM t1p_ones; -- ok +SELECT o,p FROM t1p_ones; -- ok +SELECT * FROM t1p_tens; -- failed +SELECT o FROM t1p_tens; -- ok +SELECT o,p FROM t1p_tens; -- ok +--- + +SELECT * FROM customer; -- failed SELECT cid, cname, customer_credit(cid) FROM customer; -- ok -SELECT count(*) FROM t5; -- ok +SELECT count(*) FROM t5; -- ok SELECT count(*) FROM t5 WHERE g IS NULL; -- failed +--- +-- partitioned table parent +SELECT count(*) FROM t1p; -- ok +SELECT count(*) FROM t1p WHERE q IS NULL; -- failed +-- partitioned table children +SELECT count(*) FROM t1p_ones; -- ok +SELECT count(*) FROM t1p_ones WHERE q IS NULL; -- failed +SELECT count(*) FROM t1p_tens; -- ok +SELECT count(*) FROM t1p_tens WHERE q IS NULL; -- failed +--- + INSERT INTO t1 VALUES (4, 'abc'); -- ok INSERT INTO t2 VALUES (4, 'xyz'); -- failed INSERT INTO t3 VALUES (4, 'stu'); -- ok @@ -81,6 +134,19 @@ INSERT INTO t5 VALUES (1,2,3); -- failed INSERT INTO t5 (e,f) VALUES ('abc', 'def'); -- failed INSERT INTO t5 (e) VALUES ('abc'); -- ok +--- +-- partitioned table parent +INSERT INTO t1p (o,p) VALUES (9, 'mno'); -- failed +INSERT INTO t1p (o) VALUES (9); -- ok +INSERT INTO t1p (o,p) VALUES (99, 'pqr'); -- failed +INSERT INTO t1p (o) VALUES (99); -- ok +-- partitioned table children +INSERT INTO t1p_ones (o,p) VALUES (9, 'mno'); -- failed +INSERT INTO t1p_ones (o) VALUES (9); -- ok +INSERT INTO t1p_tens (o,p) VALUES (99, 'pqr'); -- failed +INSERT INTO t1p_tens (o) VALUES (99); -- ok +--- + UPDATE t1 SET b = b || '_upd'; -- ok UPDATE t2 SET y = y || '_upd'; -- failed UPDATE t3 SET t = t || '_upd'; -- failed @@ -89,6 +155,21 @@ UPDATE t5 SET e = 'xyz'; -- ok UPDATE t5 SET e = f || '_upd'; -- ok UPDATE t5 SET e = g || '_upd'; -- failed +--- +-- partitioned table parent +UPDATE t1p SET o = 9 WHERE o < 10; -- ok +UPDATE t1p SET o = 99 WHERE o >= 10; -- ok +UPDATE t1p SET o = ascii(COALESCE(p,'upd'))%10 WHERE o < 10; -- ok +UPDATE t1p SET o = ascii(COALESCE(q,'upd'))%100 WHERE o >= 10; -- failed +-- partitioned table children +UPDATE t1p_ones SET o = 9; -- ok +UPDATE t1p_ones SET o = ascii(COALESCE(p,'upd'))%10; -- ok +UPDATE t1p_ones SET o = ascii(COALESCE(q,'upd'))%10; -- failed +UPDATE t1p_tens SET o = 99; -- ok +UPDATE t1p_tens SET o = ascii(COALESCE(p,'upd'))%100; -- ok +UPDATE t1p_tens SET o = ascii(COALESCE(q,'upd'))%100; -- failed +--- + DELETE FROM t1; -- ok DELETE FROM t2; -- failed DELETE FROM t3; -- failed @@ -97,6 +178,18 @@ DELETE FROM t5; -- ok DELETE FROM t5 WHERE f IS NULL; -- ok DELETE FROM t5 WHERE g IS NULL; -- failed +--- +-- partitioned table parent +DELETE FROM t1p; -- ok +DELETE FROM t1p WHERE p IS NULL; -- ok +DELETE FROM t1p WHERE p IS NULL; -- failed +-- partitioned table children +DELETE FROM t1p_ones WHERE p IS NULL; -- ok +DELETE FROM t1p_ones WHERE q IS NULL; -- failed; +DELETE FROM t1p_tens WHERE p IS NULL; -- ok +DELETE FROM t1p_tens WHERE q IS NULL; -- failed +--- + -- -- COPY TO/FROM statements -- @@ -107,6 +200,17 @@ COPY t4 TO '/dev/null'; -- failed COPY t5 TO '/dev/null'; -- failed COPY t5(e,f) TO '/dev/null'; -- ok +--- +-- partitioned table parent +COPY (SELECT * FROM t1p) TO '/dev/null'; -- failed +COPY (SELECT (o,p) FROM t1p) TO '/dev/null'; -- ok +-- partitioned table children +COPY t1p_ones TO '/dev/null'; -- failed +COPY t1p_ones(o,p) TO '/dev/null'; -- ok +COPY t1p_tens TO '/dev/null'; -- failed +COPY t1p_tens(o,p) TO '/dev/null'; -- ok +--- + COPY t1 FROM '/dev/null'; -- ok COPY t2 FROM '/dev/null'; -- failed COPY t3 FROM '/dev/null'; -- ok @@ -115,6 +219,17 @@ COPY t5 FROM '/dev/null'; -- failed COPY t5 (e,f) FROM '/dev/null'; -- failed COPY t5 (e) FROM '/dev/null'; -- ok +--- +-- partitioned table parent +COPY t1p FROM '/dev/null'; -- failed +COPY t1p (o) FROM '/dev/null'; -- ok +-- partitioned table children +COPY t1p_ones FROM '/dev/null'; -- failed +COPY t1p_ones (o) FROM '/dev/null'; -- ok +COPY t1p_tens FROM '/dev/null'; -- failed +COPY t1p_tens (o) FROM '/dev/null'; -- ok +--- + -- -- Schema search path -- @@ -132,6 +247,7 @@ DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; DROP TABLE IF EXISTS t5 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; DROP TABLE IF EXISTS customer CASCADE; DROP SCHEMA IF EXISTS my_schema_1 CASCADE; DROP SCHEMA IF EXISTS my_schema_2 CASCADE; diff --git a/contrib/sepgsql/sql/label.sql b/contrib/sepgsql/sql/label.sql index 49780b2..7809032 100644 --- a/contrib/sepgsql/sql/label.sql +++ b/contrib/sepgsql/sql/label.sql @@ -64,6 +64,22 @@ INSERT INTO var_tbl VALUES (2,'xxx'), (3,'yyy'), (4,'zzz'), (5,'xyz'); SECURITY LABEL ON TABLE var_tbl IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; +CREATE TABLE foo_ptbl(o int, p text) PARTITION BY RANGE (o); +CREATE TABLE foo_ptbl_ones PARTITION OF foo_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE foo_ptbl_tens PARTITION OF foo_ptbl FOR VALUES FROM ('10') TO ('100'); + +INSERT INTO foo_ptbl VALUES (0, 'aaa'), (9,'bbb'), (10,'ccc'), (99,'ddd'); +SECURITY LABEL ON TABLE foo_ptbl + IS 'system_u:object_r:sepgsql_regtest_foo_table_t:s0'; + +CREATE TABLE var_ptbl(q int, r text) PARTITION BY RANGE (q); +CREATE TABLE var_ptbl_ones PARTITION OF var_ptbl FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE var_ptbl_tens PARTITION OF var_ptbl FOR VALUES FROM ('10') TO ('100'); + +INSERT INTO var_ptbl VALUES (0,'xxx'), (9,'yyy'), (10,'zzz'), (99,'xyz'); +SECURITY LABEL ON TABLE var_ptbl + IS 'system_u:object_r:sepgsql_regtest_var_table_t:s0'; + -- -- Tests for default labeling behavior -- @@ -75,10 +91,30 @@ INSERT INTO t3 VALUES (1, 'sss'), (2, 'ttt'), (3, 'uuu'); CREATE TABLE t4 (m int, n text); INSERT INTO t4 VALUES (1,'mmm'), (2,'nnn'), (3,'ooo'); +-- @SECURITY-CONTEXT=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 +CREATE TABLE tpart (o int, p text) PARTITION BY RANGE (o); + +CREATE TABLE tpart_ones PARTITION OF tpart FOR VALUES FROM ('0') TO ('10'); +-- @SECURITY-CONTEXT=unconfined_u:unconfined_r:sepgsql_regtest_dba_t:s0 +CREATE TABLE tpart_tens PARTITION OF tpart FOR VALUES FROM ('10') TO ('100'); + +INSERT INTO tpart VALUES (0, 'aaa'); +INSERT INTO tpart VALUES (9, 'bbb'); +INSERT INTO tpart VALUES (99, 'ccc'); + SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3'); + WHERE provider = 'selinux' AND objtype = 'table' AND objname in ('t1', 't2', 't3', + 'tpart', + 'tpart_ones', + 'tpart_tens') + ORDER BY objname ASC; SELECT objtype, objname, label FROM pg_seclabels - WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' OR objname like 't4.%'); + WHERE provider = 'selinux' AND objtype = 'column' AND (objname like 't3.%' + OR objname like 't4.%' + OR objname like 'tpart.%' + OR objname like 'tpart_ones.%' + OR objname like 'tpart_tens.%') + ORDER BY objname ASC; -- -- Tests for SECURITY LABEL @@ -92,6 +128,14 @@ SECURITY LABEL ON COLUMN t2 IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- be failed SECURITY LABEL ON COLUMN t2.b IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok +SECURITY LABEL ON TABLE tpart + IS 'invalid security context'; -- be failed +SECURITY LABEL ON COLUMN tpart + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- be failed +SECURITY LABEL ON COLUMN tpart.o + IS 'system_u:object_r:sepgsql_ro_table_t:s0'; -- ok -- -- Tests for Trusted Procedures @@ -198,8 +242,10 @@ SELECT auth_func('foo', 'acbd18db4cc2f85cedef654fccc4a4d8'); SELECT sepgsql_getcon(); SELECT * FROM foo_tbl; -- OK +SELECT * FROM foo_ptbl; -- OK SELECT * FROM var_tbl; -- failed +SELECT * FROM var_ptbl; -- failed SELECT * FROM auth_tbl; -- failed @@ -208,8 +254,10 @@ SELECT sepgsql_getcon(); -- the pooler cannot touch these tables directly SELECT * FROM foo_tbl; -- failed +SELECT * FROM foo_ptbl; -- failed SELECT * FROM var_tbl; -- failed +SELECT * FROM var_ptbl; -- failed -- switch to "var" SELECT auth_func('var', 'b2145aac704ce76dbe1ac7adac535b23'); @@ -217,8 +265,10 @@ SELECT auth_func('var', 'b2145aac704ce76dbe1ac7adac535b23'); SELECT sepgsql_getcon(); SELECT * FROM foo_tbl; -- failed +SELECT * FROM foo_ptbl; -- failed SELECT * FROM var_tbl; -- OK +SELECT * FROM var_ptbl; -- OK SELECT * FROM auth_tbl; -- failed @@ -236,6 +286,7 @@ DROP TABLE IF EXISTS t1 CASCADE; DROP TABLE IF EXISTS t2 CASCADE; DROP TABLE IF EXISTS t3 CASCADE; DROP TABLE IF EXISTS t4 CASCADE; +DROP TABLE IF EXISTS tpart CASCADE; DROP FUNCTION IF EXISTS f1() CASCADE; DROP FUNCTION IF EXISTS f2() CASCADE; DROP FUNCTION IF EXISTS f3() CASCADE; diff --git a/contrib/sepgsql/sql/misc.sql b/contrib/sepgsql/sql/misc.sql index c277711..bd5b6e2 100644 --- a/contrib/sepgsql/sql/misc.sql +++ b/contrib/sepgsql/sql/misc.sql @@ -10,17 +10,31 @@ LOAD '$libdir/sepgsql'; -- failed CREATE TABLE t1 (x int, y text); INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(1,100) x); +CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o); +CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10'); +CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100'); +INSERT INTO t1p (SELECT x, md5(x::text) FROM generate_series(0,99) x); + SET sepgsql.debug_audit = on; SET client_min_messages = log; -- regular function and operators SELECT * FROM t1 WHERE x > 50 AND y like '%64%'; +SELECT * FROM t1p WHERE o > 50 AND p like '%64%'; +SELECT * FROM t1p_ones WHERE o > 50 AND p like '%64%'; +SELECT * FROM t1p_tens WHERE o > 50 AND p like '%64%'; -- aggregate function SELECT MIN(x), AVG(x) FROM t1; +SELECT MIN(o), AVG(o) FROM t1p; +SELECT MIN(o), AVG(o) FROM t1p_ones; +SELECT MIN(o), AVG(o) FROM t1p_tens; -- window function SELECT row_number() OVER (order by x), * FROM t1 WHERE y like '%86%'; +SELECT row_number() OVER (order by o), * FROM t1p WHERE p like '%86%'; +SELECT row_number() OVER (order by o), * FROM t1p_ones WHERE p like '%86%'; +SELECT row_number() OVER (order by o), * FROM t1p_tens WHERE p like '%86%'; RESET sepgsql.debug_audit; RESET client_min_messages; @@ -28,3 +42,4 @@ RESET client_min_messages; -- Cleanup -- DROP TABLE IF EXISTS t1 CASCADE; +DROP TABLE IF EXISTS t1p CASCADE; -- 1.8.3.1
^ permalink raw reply [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
@ 2017-04-09 21:04                                                         ` Joe Conway <mail@joeconway.com>
  2017-04-09 21:28                                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  1 sibling, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-09 21:04 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 04/08/2017 07:29 AM, Stephen Frost wrote:
> * Joe Conway (mail@joeconway.com) wrote:
>> On 04/07/2017 05:36 PM, Robert Haas wrote:
>> > On Fri, Apr 7, 2017 at 5:22 PM, Joe Conway <mail@joeconway.com> wrote:
>> >> 1) commit the 0002 patch now before the feature freeze and follow up
>> >>    with the regression test patch when ready in a couple of days
>> >> 2) hold off on both patches until ready
>> >> 3) push both patches to the next commitfest/pg11
>> >>
>> >> Some argue this is an open issue against the new partitioning feature in
>> >> pg10 and therefore should be addressed now, and others do not. I can see
>> >> both sides of that argument.
>> >>
>> >> In any case, thoughts on what to do?
>> > 
>> > Speaking only for myself, I'm OK with any of those options, provided
>> > that that "a couple" means what my dictionary says it means.
>> 
>> Thanks. I'd prefer not to do #1 actually, and I think we can adhere to
>> the dictionary meaning of "a couple" (i.e. by EOD Sunday). Assuming we
>> are ready by Sunday I will push both together (#2) or else I will move
>> them both together to the next CF (#3).
> 
> Sounds good to me.

Having heard no objections, committed and pushed as per option #2.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-09 21:28                                                           ` Joe Conway <mail@joeconway.com>
  2017-04-09 21:49                                                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-09 21:28 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 04/09/2017 02:04 PM, Joe Conway wrote:
> On 04/08/2017 07:29 AM, Stephen Frost wrote:
>> * Joe Conway (mail@joeconway.com) wrote:
>>> On 04/07/2017 05:36 PM, Robert Haas wrote:
>>> > On Fri, Apr 7, 2017 at 5:22 PM, Joe Conway <mail@joeconway.com> wrote:
>>> >> 1) commit the 0002 patch now before the feature freeze and follow up
>>> >>    with the regression test patch when ready in a couple of days
>>> >> 2) hold off on both patches until ready
>>> >> 3) push both patches to the next commitfest/pg11
>>> >>
>>> >> Some argue this is an open issue against the new partitioning feature in
>>> >> pg10 and therefore should be addressed now, and others do not. I can see
>>> >> both sides of that argument.
>>> >>
>>> >> In any case, thoughts on what to do?
>>> > 
>>> > Speaking only for myself, I'm OK with any of those options, provided
>>> > that that "a couple" means what my dictionary says it means.
>>> 
>>> Thanks. I'd prefer not to do #1 actually, and I think we can adhere to
>>> the dictionary meaning of "a couple" (i.e. by EOD Sunday). Assuming we
>>> are ready by Sunday I will push both together (#2) or else I will move
>>> them both together to the next CF (#3).
>> 
>> Sounds good to me.
> 
> Having heard no objections, committed and pushed as per option #2.

Interesting -- rhino is now failing. I tested a minute ago manually on
the same buildfarm animal and it passed. I'm on it.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:28                                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-09 21:49                                                             ` Andres Freund <andres@anarazel.de>
  2017-04-09 22:01                                                               ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-09 21:49 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; Andrew Dunstan <andrew@dunslane.net>; +Cc: Stephen Frost <sfrost@snowman.net>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 2017-04-09 14:28:48 -0700, Joe Conway wrote:
> Interesting -- rhino is now failing. I tested a minute ago manually on
> the same buildfarm animal and it passed. I'm on it.

The module for segpsql really needs to be improved so it logs
regression.diffs - iirc several other modules do.

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:28                                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:49                                                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-09 22:01                                                               ` Joe Conway <mail@joeconway.com>
  2017-04-09 22:45                                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-09 22:01 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; Andrew Dunstan <andrew@dunslane.net>; +Cc: Stephen Frost <sfrost@snowman.net>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 04/09/2017 02:49 PM, Andres Freund wrote:
> On 2017-04-09 14:28:48 -0700, Joe Conway wrote:
>> Interesting -- rhino is now failing. I tested a minute ago manually on
>> the same buildfarm animal and it passed. I'm on it.
> 
> The module for segpsql really needs to be improved so it logs
> regression.diffs - iirc several other modules do.

Sure, but for another day I think.

I turned on the buildfarm "keep" setting and looked at the diffs. The
issue is that in there are a few places that do "SELECT ... FROM
pg_seclabels ... ORDER BY ..." and when manually testing I get default
database encoding "UTF8" but with the buildfarm I get "SQL_ASCII", hence
a different sorting.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:28                                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:49                                                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-09 22:01                                                               ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-09 22:45                                                                 ` Joe Conway <mail@joeconway.com>
  2017-04-09 23:14                                                                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 61+ messages in thread

From: Joe Conway @ 2017-04-09 22:45 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; Andrew Dunstan <andrew@dunslane.net>; +Cc: Stephen Frost <sfrost@snowman.net>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 04/09/2017 03:01 PM, Joe Conway wrote:
> On 04/09/2017 02:49 PM, Andres Freund wrote:
>> On 2017-04-09 14:28:48 -0700, Joe Conway wrote:
>>> Interesting -- rhino is now failing. I tested a minute ago manually on
>>> the same buildfarm animal and it passed. I'm on it.
>> 
>> The module for segpsql really needs to be improved so it logs
>> regression.diffs - iirc several other modules do.
> 
> Sure, but for another day I think.
> 
> I turned on the buildfarm "keep" setting and looked at the diffs. The
> issue is that in there are a few places that do "SELECT ... FROM
> pg_seclabels ... ORDER BY ..." and when manually testing I get default
> database encoding "UTF8" but with the buildfarm I get "SQL_ASCII", hence
> a different sorting.

Looks like adding COLLATE "C" in the ORDER BY clauses does the trick. Is
that the preferred method for this kind of issue?

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:28                                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:49                                                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-09 22:01                                                               ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 22:45                                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
@ 2017-04-09 23:14                                                                   ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-09 23:39                                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 61+ messages in thread

From: Tom Lane @ 2017-04-09 23:14 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: Andres Freund <andres@anarazel.de>; Andrew Dunstan <andrew@dunslane.net>; Stephen Frost <sfrost@snowman.net>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

Joe Conway <mail@joeconway.com> writes:
>> I turned on the buildfarm "keep" setting and looked at the diffs. The
>> issue is that in there are a few places that do "SELECT ... FROM
>> pg_seclabels ... ORDER BY ..." and when manually testing I get default
>> database encoding "UTF8" but with the buildfarm I get "SQL_ASCII", hence
>> a different sorting.

> Looks like adding COLLATE "C" in the ORDER BY clauses does the trick. Is
> that the preferred method for this kind of issue?

Yeah, that's pretty much the standard fix nowadays.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-03 16:02             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 13:45               ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-04 14:19                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 16:55                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-04 17:02                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-04 22:56                       ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 01:29                         ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 04:58                           ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 15:31                             ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-05 16:04                               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:19                                 ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 17:22                                   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-05 21:29                                     ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-06 15:29                                       ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 19:35                                         ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-06 21:52                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-07 18:36                                             ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 18:37                                               ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-07 21:22                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 00:36                                                   ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-08 02:36                                                     ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-08 14:29                                                       ` Re: partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-04-09 21:04                                                         ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:28                                                           ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 21:49                                                             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-09 22:01                                                               ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 22:45                                                                 ` Re: partitioned tables and contrib/sepgsql Joe Conway <mail@joeconway.com>
  2017-04-09 23:14                                                                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-09 23:39                                                                     ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 61+ messages in thread

From: Joe Conway @ 2017-04-09 23:39 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; Andrew Dunstan <andrew@dunslane.net>; Stephen Frost <sfrost@snowman.net>; Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 04/09/2017 04:14 PM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>>> I turned on the buildfarm "keep" setting and looked at the diffs. The
>>> issue is that in there are a few places that do "SELECT ... FROM
>>> pg_seclabels ... ORDER BY ..." and when manually testing I get default
>>> database encoding "UTF8" but with the buildfarm I get "SQL_ASCII", hence
>>> a different sorting.
> 
>> Looks like adding COLLATE "C" in the ORDER BY clauses does the trick. Is
>> that the preferred method for this kind of issue?
> 
> Yeah, that's pretty much the standard fix nowadays.


Good to hear, thanks -- rhino is back to green.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
@ 2017-04-05 14:30             ` Andres Freund <andres@anarazel.de>
  2017-04-05 14:48               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-05 14:30 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 2017-03-31 20:23:39 -0400, Robert Haas wrote:
> On Fri, Mar 31, 2017 at 2:14 PM, Mike Palmiotto
> <mike.palmiotto@crunchydata.com> wrote:
> > Attached you will find two patches, which were rebased on master as of
> > 156d388 (applied with `git am --revert [patch file]`). The first gets
> > rid of some pesky compiler warnings and the second implements the
> > sepgsql handling of partitioned tables.
> 
> 0001 has the problem that we have a firm rule against putting any
> #includes whatsoever before "postgres.h".  This stdbool issue has come
> up before, though, and I fear we're going to need to do something
> about it.

I think in this case it makes sense to deviate from that rule,
temporarily and locally.

- Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 14:30             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-05 14:48               ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:53                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 61+ messages in thread

From: Tom Lane @ 2017-04-05 14:48 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Andres Freund <andres@anarazel.de> writes:
> On 2017-03-31 20:23:39 -0400, Robert Haas wrote:
>> 0001 has the problem that we have a firm rule against putting any
>> #includes whatsoever before "postgres.h".  This stdbool issue has come
>> up before, though, and I fear we're going to need to do something
>> about it.

> I think in this case it makes sense to deviate from that rule,
> temporarily and locally.

I'd really rather not.  It might be safe here, because this code
only works on Linux anyway, but it's still a dangerous precedent.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 14:30             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 14:48               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 14:53                 ` Andres Freund <andres@anarazel.de>
  2017-04-05 15:06                   ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 61+ messages in thread

From: Andres Freund @ 2017-04-05 14:53 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

On 2017-04-05 10:48:27 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2017-03-31 20:23:39 -0400, Robert Haas wrote:
> >> 0001 has the problem that we have a firm rule against putting any
> >> #includes whatsoever before "postgres.h".  This stdbool issue has come
> >> up before, though, and I fear we're going to need to do something
> >> about it.
> 
> > I think in this case it makes sense to deviate from that rule,
> > temporarily and locally.
> 
> I'd really rather not.  It might be safe here, because this code
> only works on Linux anyway, but it's still a dangerous precedent.

Well, what's the alternative for v10?  There's already precedent btw.,
cf plperl.h undefining bool.

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread

* Re: partitioned tables and contrib/sepgsql
  2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
  2017-03-27 14:47 ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 15:22   ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-27 15:46     ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-03-27 16:09       ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-03-31 18:14         ` Re: partitioned tables and contrib/sepgsql Mike Palmiotto <mike.palmiotto@crunchydata.com>
  2017-04-01 00:23           ` Re: partitioned tables and contrib/sepgsql Robert Haas <robertmhaas@gmail.com>
  2017-04-05 14:30             ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
  2017-04-05 14:48               ` Re: partitioned tables and contrib/sepgsql Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 14:53                 ` Re: partitioned tables and contrib/sepgsql Andres Freund <andres@anarazel.de>
@ 2017-04-05 15:06                   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 61+ messages in thread

From: Tom Lane @ 2017-04-05 15:06 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Robert Haas <robertmhaas@gmail.com>; Mike Palmiotto <mike.palmiotto@crunchydata.com>; Stephen Frost <sfrost@snowman.net>; pgsql-hackers

Andres Freund <andres@anarazel.de> writes:
> On 2017-04-05 10:48:27 -0400, Tom Lane wrote:
>> I'd really rather not.  It might be safe here, because this code
>> only works on Linux anyway, but it's still a dangerous precedent.

> Well, what's the alternative for v10?  There's already precedent btw.,
> cf plperl.h undefining bool.

Well, the 0001a patch amounted to undefining bool, once you drop
the redundant typedef redeclaration.  So that's a direction we have
some track record with.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 61+ messages in thread


end of thread, other threads:[~2017-04-09 23:39 UTC | newest]

Thread overview: 61+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 14:47 partitioned tables and contrib/sepgsql Stephen Frost <sfrost@snowman.net>
2017-03-09 14:59 ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-03-09 15:05   ` Stephen Frost <sfrost@snowman.net>
2017-03-27 14:47 ` Robert Haas <robertmhaas@gmail.com>
2017-03-27 15:22   ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-03-27 15:46     ` Robert Haas <robertmhaas@gmail.com>
2017-03-27 16:09       ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-03-31 18:14         ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-03-31 18:42           ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-01 00:23           ` Robert Haas <robertmhaas@gmail.com>
2017-04-03 15:38             ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-03 16:02             ` Joe Conway <mail@joeconway.com>
2017-04-04 13:45               ` Robert Haas <robertmhaas@gmail.com>
2017-04-04 14:19                 ` Joe Conway <mail@joeconway.com>
2017-04-04 16:55                   ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-04 17:02                     ` Joe Conway <mail@joeconway.com>
2017-04-04 22:56                       ` Joe Conway <mail@joeconway.com>
2017-04-05 01:29                         ` Robert Haas <robertmhaas@gmail.com>
2017-04-05 04:58                           ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 05:17                             ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-04-05 05:20                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 15:56                                 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-04-05 16:14                                 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 07:02                             ` Andres Freund <andres@anarazel.de>
2017-04-05 13:43                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 14:28                                 ` Andres Freund <andres@anarazel.de>
2017-04-05 14:45                                   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 14:52                                     ` Andres Freund <andres@anarazel.de>
2017-04-05 15:25                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 13:48                             ` Robert Haas <robertmhaas@gmail.com>
2017-04-05 15:31                             ` Joe Conway <mail@joeconway.com>
2017-04-05 16:04                               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 16:06                                 ` Andres Freund <andres@anarazel.de>
2017-04-05 16:26                                   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 16:53                                 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-04-05 17:19                                 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 17:22                                   ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-05 21:29                                     ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-06 15:08                                       ` Joe Conway <mail@joeconway.com>
2017-04-06 15:29                                       ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-06 18:19                                         ` Joe Conway <mail@joeconway.com>
2017-04-06 19:35                                         ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-06 21:52                                           ` Joe Conway <mail@joeconway.com>
2017-04-07 18:36                                             ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-07 18:37                                               ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-07 21:22                                                 ` Joe Conway <mail@joeconway.com>
2017-04-08 00:36                                                   ` Robert Haas <robertmhaas@gmail.com>
2017-04-08 02:36                                                     ` Joe Conway <mail@joeconway.com>
2017-04-08 14:29                                                       ` Stephen Frost <sfrost@snowman.net>
2017-04-09 17:18                                                         ` Mike Palmiotto <mike.palmiotto@crunchydata.com>
2017-04-09 21:04                                                         ` Joe Conway <mail@joeconway.com>
2017-04-09 21:28                                                           ` Joe Conway <mail@joeconway.com>
2017-04-09 21:49                                                             ` Andres Freund <andres@anarazel.de>
2017-04-09 22:01                                                               ` Joe Conway <mail@joeconway.com>
2017-04-09 22:45                                                                 ` Joe Conway <mail@joeconway.com>
2017-04-09 23:14                                                                   ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-09 23:39                                                                     ` Joe Conway <mail@joeconway.com>
2017-04-05 14:30             ` Andres Freund <andres@anarazel.de>
2017-04-05 14:48               ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 14:53                 ` Andres Freund <andres@anarazel.de>
2017-04-05 15:06                   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox