Re: what causes new temp schemas to be created

2023-07-10 Thread Ted Toth
So it's an optimization to reuse existing but currently unused temp schemas, correct? On Mon, Jul 10, 2023 at 11:22 AM David G. Johnston wrote: > > On Mon, Jul 10, 2023 at 9:20 AM Ted Toth wrote: >> >> I don't see that the schema is removed when the session is over

Re: what causes new temp schemas to be created

2023-07-10 Thread Ted Toth
on, Jul 10, 2023 at 7:18 AM Ted Toth wrote: >> >> When a temp table is created I see a pg_temp_NNN (for example >> pg_temp_3, pg_toast_temp_3) schemas created when/why are additional >> temp schemas created( pg_temp_4/pg_toast_temp_4)? >> > > Temporary schemas are

what causes new temp schemas to be created

2023-07-10 Thread Ted Toth
When a temp table is created I see a pg_temp_NNN (for example pg_temp_3, pg_toast_temp_3) schemas created when/why are additional temp schemas created( pg_temp_4/pg_toast_temp_4)? Ted

Re: temp table security labels

2023-07-07 Thread Ted Toth
seems to me that sepgsql_schema_post_create should be doing a selabel_lookup and using that default label if one exists instead of computing the label ... hmm I'll have to think about it On Fri, Jul 7, 2023 at 10:44 AM Ted Toth wrote: > > I see it now sepgsql_schema_post_create

Re: temp table security labels

2023-07-07 Thread Ted Toth
I see it now sepgsql_schema_post_create is doing it ... it's just not doing what I think it should :( On Fri, Jul 7, 2023 at 8:05 AM Ted Toth wrote: > > Also AFAICT the schema created for the temp table does not get deleted > at the end of the session which also causes issues. >

Re: temp table security labels

2023-07-07 Thread Ted Toth
Also AFAICT the schema created for the temp table does not get deleted at the end of the session which also causes issues. On Fri, Jul 7, 2023 at 7:43 AM Ted Toth wrote: > > I'm seeing security labels set on db objects when a temporary table is > created but they don't ma

temp table security labels

2023-07-07 Thread Ted Toth
I'm seeing security labels set on db objects when a temporary table is created but they don't match the labels I've configured in my sepgsql_contexts file. Our code doesn't actually execute a "SECURITY LABEL ..." command for the temp tables but something else must be doing so because I see pg_temp_

dynamic partition table inserts

2023-01-25 Thread Ted Toth
I'm creating partition tables on the fly following the technique described in https://minervadb.com/index.php/postgresql-dynamic-partitioning/ . Regardless of whether a partition table is created or already exists all I really want to do is change the destination table (TG_TABLE_NAME?) of the inser

Re: table inheritance partition and indexes

2022-11-25 Thread Ted Toth
, 2022 at 8:13 PM David Rowley wrote: > On Thu, 24 Nov 2022 at 11:34, Ted Toth wrote: > > > > On Wed, Nov 23, 2022 at 4:01 PM Tom Lane wrote: > >> Then you're stuck managing it manually. But ATTACH PARTITION is > >> not relevant to INHERITS-style partitionin

Re: table inheritance partition and indexes

2022-11-23 Thread Ted Toth
On Wed, Nov 23, 2022 at 4:01 PM Tom Lane wrote: > Ted Toth writes: > > On Wed, Nov 23, 2022 at 1:24 PM Ron wrote: > >> Out of curiosity, why INHERITS in v13 instead of PARTITION BY? > > > Because none of the declarative partition types do what I want. > > Then

Re: table inheritance partition and indexes

2022-11-23 Thread Ted Toth
Because none of the declarative partition types do what I want. On Wed, Nov 23, 2022 at 1:24 PM Ron wrote: > Out of curiosity, why INHERITS in v13 instead of PARTITION BY? > > On 11/23/22 09:31, Ted Toth wrote: > > I've created a table with a number of indexes and then c

table inheritance partition and indexes

2022-11-23 Thread Ted Toth
I've created a table with a number of indexes and then created a partition table that inherits from it using "CREATE TABLE... INHERITS..." . I've then queried pg_indexes on the parent for its indexes and tried creating matching indexes on the child and attaching them to the parent table indexes. Ho

security label and indexes

2022-11-22 Thread Ted Toth
I noticed that the 'security label' sql command does not include indexes as objects that can be labeled, why is that? What sepgsql security class are indexes, db_table? Ted

what's inherited

2022-10-18 Thread Ted Toth
When I create a table that inherits from another table what all is inherited i.e. ownership, security policy, ...? Ted

Re: table inheritance and privileges

2022-09-28 Thread Ted Toth
esn't then inserts into it and returns 'SKIP' (plpython3u). On Wed, Sep 28, 2022 at 2:49 PM Tom Lane wrote: > > Ted Toth writes: > > I'm dynamically creating tables that inherit from another table but > > they don't inherit the access privileges. Is there

table inheritance and privileges

2022-09-28 Thread Ted Toth
I'm dynamically creating tables that inherit from another table but they don't inherit the access privileges. Is there a way to have the new tables inherit their parent tables access privileges? Ted

plpython/python string formatting

2022-08-16 Thread Ted Toth
I've just started playing with plpython but ran into a issue when I was trying to use standard python string formatting to generate a SQL string for example: s = "EXECUTE format('CREATE INDEX %s ON %s USING (column_name)' % (index_name, table_name))" but plpython then tried to run the EXECUTE inst

plpython questions

2022-08-16 Thread Ted Toth
Is this the right list to ask questions about plpython? If not what would be the best list or git repo to ask questions related to plpython? Ted

Re: when is RLS policy applied

2020-07-24 Thread Ted Toth
I've looked for information on leakproofness of operators but haven't found anything can you direct me to a source of this information? On Fri, Jul 24, 2020 at 3:40 PM Ted Toth wrote: > > On Fri, Jul 24, 2020 at 3:15 PM Tom Lane wrote: > >> Ted Toth writes: >>

Re: when is RLS policy applied

2020-07-24 Thread Ted Toth
On Fri, Jul 24, 2020 at 3:15 PM Tom Lane wrote: > Ted Toth writes: > > I'm trying to understand when RLS select policy is applied so I created > the > > follow to test but I don't understand why the query filter order is > > different for the 2 queries can a

when is RLS policy applied

2020-07-24 Thread Ted Toth
I'm trying to understand when RLS select policy is applied so I created the follow to test but I don't understand why the query filter order is different for the 2 queries can anyone explain? CREATE USER bob NOSUPERUSER; CREATE TABLE t_service (service_type text, service text); INSERT INTO t_servi

FDW and RLS

2020-05-22 Thread Ted Toth
Will RLS be applied to data being retrieved via a FDW? Ted

Re: jsonb unique constraints

2020-05-05 Thread Ted Toth
I was able to create a unique index, thanks. On Tue, May 5, 2020 at 10:38 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tue, May 5, 2020 at 8:33 AM Ted Toth wrote: > >> Can you have unique constraints on jsonb columns keys? I've looked for >> exampl

jsonb unique constraints

2020-05-05 Thread Ted Toth
Can you have unique constraints on jsonb columns keys? I've looked for examples but haven't found any what is the proper syntax? Here's what I tried: CREATE TABLE report_json ( recnum int, id integer, report jsonb, PRIMARY KEY (recnum), CONSTRAINT report_json_unique_constraint

Re: performance of first exec of prepared statement

2020-04-17 Thread Ted Toth
On Fri, Apr 17, 2020 at 8:28 AM Ted Toth wrote: > > > On Thu, Apr 16, 2020 at 8:09 PM Rob Sargent wrote: > >> On 4/16/20 6:15 PM, Adrian Klaver wrote: >> > On 4/16/20 4:59 PM, Ted Toth wrote: >> >> >> >> >> >> On Thu, Apr 16,

Re: performance of first exec of prepared statement

2020-04-17 Thread Ted Toth
On Thu, Apr 16, 2020 at 8:09 PM Rob Sargent wrote: > On 4/16/20 6:15 PM, Adrian Klaver wrote: > > On 4/16/20 4:59 PM, Ted Toth wrote: > >> > >> > >> On Thu, Apr 16, 2020 at 6:29 PM Ted Toth >> <mailto:txt...@gmail.com>> wrote: > >> >

Re: performance of first exec of prepared statement

2020-04-16 Thread Ted Toth
On Thu, Apr 16, 2020 at 6:29 PM Ted Toth wrote: > I've noticed that the first exec of an INSERT prepared statement takes ~5 > time longer (I'm using libpq in C and wrapping the calls to time them) then > subsequent exec's is this the expected behavior and if so is there

performance of first exec of prepared statement

2020-04-16 Thread Ted Toth
I've noticed that the first exec of an INSERT prepared statement takes ~5 time longer (I'm using libpq in C and wrapping the calls to time them) then subsequent exec's is this the expected behavior and if so is there any thing I can do to mitigate this affect? Ted

libpq prepared statement insert null for foreign key

2020-03-09 Thread Ted Toth
I tries setting the parameter for the foreign NULL: params[i] = NULL; and I get a 'Key not present in table ...' error. How do I insert a record where I don't have a foreign key yet? Ted

libpq and escaping array string literals

2020-03-06 Thread Ted Toth
I've got so C code that interacting with a table containing a field of type text[]. Strings I've got to put in the array may be unicode and or contain single or double quotes etc ... What's the best way to escape these strings? Ted

Re: before insert for each row trigger on upsert

2020-02-20 Thread Ted Toth
On Thu, Feb 20, 2020 at 2:32 PM Adrian Klaver wrote: > On 2/20/20 12:17 PM, Ted Toth wrote: > > I'm a little confused why the before insert trigger fires al all but > > since it does is there a way to know that an update will occur? > > Because ON CONFLICT DO UPDATE is

before insert for each row trigger on upsert

2020-02-20 Thread Ted Toth
I'm a little confused why the before insert trigger fires al all but since it does is there a way to know that an update will occur? Basically I don't want the trigger affect the row on update. Ted

Re: large numbers of inserts out of memory strategy

2017-11-30 Thread Ted Toth
On Thu, Nov 30, 2017 at 11:40 AM, Peter J. Holzer wrote: > On 2017-11-30 08:43:32 -0600, Ted Toth wrote: >> Date: Thu, 30 Nov 2017 08:43:32 -0600 >> From: Ted Toth >> To: "Peter J. Holzer" >> Cc: pgsql-general@lists.postgresql.org >> Subject: Re: larg

Re: large numbers of inserts out of memory strategy

2017-11-30 Thread Ted Toth
On Thu, Nov 30, 2017 at 4:22 AM, Peter J. Holzer wrote: > On 2017-11-29 08:32:02 -0600, Ted Toth wrote: >> Yes I did generate 1 large DO block: >> >> DO $$ >> DECLARE thingid bigint; thingrec bigint; thingdataid bigint; >> BEGIN >> INSERT INTO thing >&

Re: large numbers of inserts out of memory strategy

2017-11-29 Thread Ted Toth
On Tue, Nov 28, 2017 at 9:59 PM, Tom Lane wrote: > Brian Crowell writes: >> On Tue, Nov 28, 2017 at 12:38 PM, Tomas Vondra >> wrote: >>> So what does the script actually do? Because psql certainly is not >>> running pl/pgsql procedures on it's own. We need to understand why >>> you're getting OOM

Re: large numbers of inserts out of memory strategy

2017-11-28 Thread Ted Toth
On Tue, Nov 28, 2017 at 12:01 PM, Tomas Vondra wrote: > > > On 11/28/2017 06:54 PM, Ted Toth wrote: >> On Tue, Nov 28, 2017 at 11:22 AM, Tomas Vondra >> wrote: >>> Hi, >>> >>> On 11/28/2017 06:17 PM, Ted Toth wrote: >>>> I&#x

Re: large numbers of inserts out of memory strategy

2017-11-28 Thread Ted Toth
On Tue, Nov 28, 2017 at 12:04 PM, Steven Lembark wrote: > On Tue, 28 Nov 2017 11:17:07 -0600 > Ted Toth wrote: > >> I'm writing a migration utility to move data from non-rdbms data >> source to a postgres db. Currently I'm generating SQL INSERT >> statement

Re: large numbers of inserts out of memory strategy

2017-11-28 Thread Ted Toth
On Tue, Nov 28, 2017 at 11:22 AM, Tomas Vondra wrote: > Hi, > > On 11/28/2017 06:17 PM, Ted Toth wrote: >> I'm writing a migration utility to move data from non-rdbms data >> source to a postgres db. Currently I'm generating SQL INSERT >> statements invol

Re: large numbers of inserts out of memory strategy

2017-11-28 Thread Ted Toth
On Tue, Nov 28, 2017 at 11:19 AM, Rob Sargent wrote: > >> On Nov 28, 2017, at 10:17 AM, Ted Toth wrote: >> >> I'm writing a migration utility to move data from non-rdbms data >> source to a postgres db. Currently I'm generating SQL INSERT >> statements

large numbers of inserts out of memory strategy

2017-11-28 Thread Ted Toth
I'm writing a migration utility to move data from non-rdbms data source to a postgres db. Currently I'm generating SQL INSERT statements involving 6 related tables for each 'thing'. With 100k or more 'things' to migrate I'm generating a lot of statements and when I try to import using psql postgres