Re: Upsert error "column reference is ambiguous"

2025-04-29 Thread David G. Johnston
On Tuesday, April 29, 2025, Tim Starling wrote: > > > This is a public interface and there may be callers in code that I don't > have access to. > You might help your cause by sharing examples of how client code uses your driver to perform upsert that runs into this limitation. David J.

Re: Upsert error "column reference is ambiguous"

2025-04-28 Thread David G. Johnston
On Monday, April 28, 2025, Tom Lane wrote: > > AFAIK, "ON CONFLICT" is a Postgres-ism. Exactly which constructs > in exactly which other databases are you citing as precedent? > I confirmed the SQLite reference from the original email. “The upsert above inserts the new vocabulary word "jovial"

Re: Upsert error "column reference is ambiguous"

2025-04-27 Thread David G. Johnston
On Sunday, April 27, 2025, Tim Starling wrote: > thus allowing it to DWIM. We intentionally choose (or, in any case have established) a SWYM approach here. Personally I’d be fine with the reduced helpfulness in trying to prevent buggy queries in the interest of being more conforming with the b

How to get the data from the query

2025-04-26 Thread David G. Johnston
On Saturday, April 26, 2025, Igor Korot wrote: > but the size comes out "" (empty) > > What is the value you are expecting? What is the minimal table definition (i.e., a one or few column table) that would produce this expected value? What does psql show if you use it to output the query against

How to properly fix memory leak

2025-04-25 Thread David G. Johnston
On Friday, April 25, 2025, Igor Korot wrote: > > And the error case was handled correctly, right? > Seems like answering that requires knowing what the query is or can be. I also have no idea what idiomatic code looks like. Though, I’d probably use PQresultErrorMessage and check affirmatively

Re: How to properly fix memory leak

2025-04-25 Thread David G. Johnston
On Friday, April 25, 2025, Igor Korot wrote: > > for( int i = 0; i < PQntuples( res ); i++ ) > { > auto temp1 = m_pimpl->m_myconv.from_bytes( PQgetvalue( > res, i, 1 ) ); > m_tablespaces.push_back( temp1 ); > } // this line gives a leak according to

Re: Another documentation issue

2025-04-23 Thread David G. Johnston
On Wednesday, April 23, 2025, Igor Korot wrote: > > The question is more about the default value... > 0 or 1, determined at server compilation time. You quoted the documentation that says this… David J.

Re: Another documentation issue

2025-04-23 Thread David G. Johnston
On Wednesday, April 23, 2025, Igor Korot wrote: > > How do you handle sch situation from the client POV? > Get the current value. If it’s non-zero the system definitely supports it. If it’s zero it probably doesn’t. But give the user an option to specify a value anyway just in case. If they

Re: Another documentation issue

2025-04-23 Thread David G. Johnston
On Tuesday, April 22, 2025, Igor Korot wrote: > Hi, ALL, > > On the page https://www.postgresql.org/docs/current/runtime-config- > query.html#GUC-SEQ-PAGE-COST > > it is only given the default value of this parameter. > > No min/max values are provided.. > > The same can be sad about > https://ww

Re: Feature Proposal: Column-Level DELETE Operation in SQL

2025-04-22 Thread David G. Johnston
On Monday, April 21, 2025, Abhishek Hatgine wrote:. > > >- > >More intuitive for developers coming from languages or NoSQL systems >where fields can be "deleted" from an object/document. > > Why should this matter to us? We don’t have this paradigm, you can’t remove columns from exist

Re: sequence on daily log partitioned table

2025-04-21 Thread David G. Johnston
On Monday, April 21, 2025, senor wrote: > > I'm mainly interested in understanding how this works or why it can't > Partition routing happens on fully-formed tuples. They thus must be formed initially using only context, like defaults, attached to the partitioned table. You can do what you want

Re: Clarification on the docs

2025-04-19 Thread David G. Johnston
On Sat, Apr 19, 2025 at 4:17 PM Igor Korot wrote: > > Could you indicate the default value for every option here? > >> >> The descriptions clearly indicate the defaults for nearly all of them, and the one exception is a single click away (gin_pending_list_limit). I don't find that the informatio

Re: Error while updating a table

2025-04-19 Thread David G. Johnston
On Sat, Apr 19, 2025 at 6:06 AM sivapostg...@yahoo.com < sivapostg...@yahoo.com> wrote: > By any chance, if I get that statement, what should I do? > Read it. What are the Steps (or documentation) to correct this issue? > > Impossible to say until the statement is read. David J.

Re: Fwd: Identify system databases

2025-04-16 Thread David G. Johnston
On Wed, Apr 16, 2025 at 8:07 AM Dominique Devienne wrote: > On Wed, Apr 16, 2025 at 4:39 PM Tom Lane wrote: > > Laurenz Albe writes: > > > On Wed, 2025-04-16 at 10:09 +0200, Dominique Devienne wrote: > > So in a way, you guys are saying one should never REVOKE CONNECT ON > DATABASE FROM PUBLIC?

Re: Fwd: Identify system databases

2025-04-15 Thread David G. Johnston
On Tue, Apr 15, 2025 at 5:24 PM Adrian Klaver wrote: > > > > By creating the initial three databases the system is more usable due to > > having established conventions. They are conventional databases, not > > system ones. > > The bottom line is the Postgres project has built an infrastructure

Re: Fwd: Identify system databases

2025-04-15 Thread David G. Johnston
On Tue, Apr 15, 2025 at 11:20 AM Adrian Klaver wrote: > On 4/15/25 09:48, David G. Johnston wrote: > > On Tue, Apr 15, 2025 at 9:31 AM Adrian Klaver > <mailto:adrian.kla...@aklaver.com>> wrote: > > > > > > > Agreed. > > > > The

Re: Fwd: Identify system databases

2025-04-15 Thread David G. Johnston
On Tue, Apr 15, 2025 at 9:31 AM Adrian Klaver wrote: > On 4/15/25 09:21, Igor Korot wrote: > > > > > > > Hi, David, > > > > On Tue, Apr 15, 2025 at 9:56 AM David G. Johnston > > mailto:david.g.johns...@gmail.com>> wrote: > > > >

Re: Identify system databases

2025-04-15 Thread David G. Johnston
On Tuesday, April 15, 2025, Igor Korot wrote: > Hi, ALL, > Is there a field in the pg_databases table which indicates that particular > DB is a system one? > What is a system database? David J.

Re: To take backup of Postgresql Database without large objects

2025-04-11 Thread David G. Johnston
On Friday, April 11, 2025, Adrian Klaver wrote: > On 4/11/25 22:06, sivapostg...@yahoo.com wrote: > > Either my command should be wrong or I'm missing something. >> > > This was explained in my post as quoted below. Yeah, the short version. Then you added a long version that just confused the

Re: To take backup of Postgresql Database without large objects

2025-04-11 Thread David G. Johnston
On Friday, April 11, 2025, sivapostg...@yahoo.com wrote: > > > bytea field also included in the backup. > Bytea typed columns are completely separate things than large objects. You cannot exclude individual columns using pg_dump. David J.

Re: Clarification on the docs

2025-04-11 Thread David G. Johnston
On Friday, April 11, 2025, Igor Korot wrote: > Hi, David, > > On Fri, Apr 11, 2025 at 9:04 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Fri, Apr 11, 2025 at 6:49 PM Igor Korot wrote: >> >>> Hi, ALL, >>> On the http

Re: Clarification on the docs

2025-04-11 Thread David G. Johnston
On Fri, Apr 11, 2025 at 6:49 PM Igor Korot wrote: > Hi, ALL, > On the > https://www.postgresql.org/docs/17/sql-createindex.html#SQL-CREATEINDEX-STORAGE-PARAMETERS > its said: > > [quote] > The optional WITH clause specifies storage parameters for the index. > Each index method has its own set of

Re: Interesting case of IMMUTABLE significantly hurting performance

2025-04-10 Thread David G. Johnston
On Thursday, April 10, 2025, Tom Lane wrote: > Merlin Moncure writes: > > I guess the real problems here are lack of feedback on a number of > fronts: > > *) the server knows the function is not immutable but lets you create it > > anyway, even though it can have negative downstream consequences

Re: Interesting case of IMMUTABLE significantly hurting performance

2025-04-10 Thread David G. Johnston
On Wednesday, April 9, 2025, Olleg Samoylov wrote: > > On 10.04.2025 01:08, Tom Lane wrote: > >> Yeah. The assumption is that you had a reason for marking the >> function IMMUTABLE and you want the planner to treat it that way >> even if it isn't really. (There are valid use-cases for that, for

Re: Capturing both IP address and hostname in the log

2025-04-10 Thread David G. Johnston
On Thu, Apr 10, 2025 at 5:22 AM Tefft, Michael J wrote: > The documentation for log_hostname says: > > log_hostname (boolean) > > By default, connection log messages only show the IP address of the > connecting host. Turning this parameter on causes logging of the host name > as well. Note that d

Re: Interesting case of IMMUTABLE significantly hurting performance

2025-04-10 Thread David G. Johnston
On Thu, Apr 10, 2025 at 8:49 AM Nico Williams wrote: > On Wed, Apr 09, 2025 at 02:43:11PM -0700, Adrian Klaver wrote: > > On 4/9/25 14:21, Nico Williams wrote: > > > That to_char is not immutable is not documented though. Though it's > > > clear when looking at the docs for the `jsonb_.*_tz()` f

Re: Interesting case of IMMUTABLE significantly hurting performance

2025-04-09 Thread David G. Johnston
On Wed, Apr 9, 2025 at 1:50 PM Laurenz Albe wrote: > If you use EXPLAIN (VERBOSE), you will see that the function gets inlined > in the fast case. > > That saves the overhead of a function call. > > The IMMUTABLE function cannot be inlined because to_char() is not > IMMUTABLE. > So, the punishme

Re: [EXTERNAL] Re: Cannot connect local with ttrust (pg_upgrade assumes it)

2025-04-09 Thread David G. Johnston
On Wed, Apr 9, 2025, 12:21 Abraham, Danny wrote: > Thanks again. > Here is the example: > > dba-tlv-x6y64k% cat pg_hba.conf > # TYPE DATABASEUSERCIDR-ADDRESS METHOD > local all all trust > hostall all 0.0.0

Re: Cannot connect local with ttrust (pg_upgrade assumes it)

2025-04-09 Thread David G. Johnston
On Wed, Apr 9, 2025 at 9:20 AM Abraham, Danny wrote: > Fail > Failures include messages indicating why. You should always share such messages. Showing the command that produced the failure is also advised. David J.

Re: Best way to check if a table is empty

2025-04-05 Thread David G. Johnston
On Sunday, March 23, 2025, Marcelo Fernandes wrote: > Hi folks, > > I came up with three strategies to verify whether a table is empty. 3 is strictly terrible worse to answer “is live row count > 0”. Using an index likely serves no/negative benefit since it contains no tuple liveness informati

Re: After upgrading libpq, the same function(PQftype) call returns a different OID

2025-04-05 Thread David G. Johnston
On Thu, Mar 20, 2025 at 2:56 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Thu, Mar 20, 2025 at 11:54 AM Tom Lane wrote: > >> I think it's a mistake to suppose that pg_type_d.h is the only > >> place where there's a risk of confusi

Re: Best way to check if a table is empty

2025-04-05 Thread David G. Johnston
On Sunday, March 23, 2025, David G. Johnston wrote: > > Maybe IOS helps though I do wonder whether a sequential scan skips over > known all-dead pages making that relative benefit go away. > Well, no, since it tracks known visible, not known non-visible, though for something like a

Re: Doubt on pg_timezone_names and pg_timezone_abbrevs

2025-03-31 Thread David G. Johnston
On Mon, Mar 31, 2025 at 8:39 PM Jayadevan M wrote: > Hello PG members, > I used 'IST' in a query like this - * (timestamp_hour) at time zone > 'IST' time_ist *and did not get the expected output - timestamp in Indian > Standard Time. So I queried the 2 views that provide timezone info and did >

Re: Querying one partition in a function takes locks on all partitions

2025-03-31 Thread David G. Johnston
On Mon, Mar 31, 2025 at 9:42 AM Renan Alves Fonseca wrote: > I'm not sure if we should mention the fix or if we should mention a > workaround... > Workarounds are ok but my observation is that "this may change in the future" comments are pointless and should be stricken from the manual because p

Re: SQL Server's WITH (NOLOCK) equivalent in PostgreSQL?

2025-03-30 Thread David G. Johnston
On Sunday, March 30, 2025, 이현진 wrote: > > Since PostgreSQL uses MVCC, I'm wondering what the best practice is for > non-blocking reads, > and whether there's an equivalent to dirty reads or READ UNCOMMITTED. > https://www.postgresql.org/docs/current/transaction-iso.html We are unable to impleme

Re: BTREE index: field ordering

2025-03-28 Thread David G. Johnston
On Fri, Mar 28, 2025 at 9:24 AM Ron Johnson wrote: > > "at least for WHERE conditions that are selective" confuses me. Aren't > _all_ WHERE clauses selective? > > >From earlier in the email, selectivity is a scale, the wording here implies "has a meaningful selectivity". "Fundamentally yes, but

Re: BTREE index: field ordering

2025-03-28 Thread David G. Johnston
On Fri, Mar 28, 2025 at 10:02 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > Selectivity is evaluating cardinality with an eye on the frequency of > the values you are actually going to be filtering on. So low cardinality > booleans can be highly selective in u

Re: Determine server version from psql script

2025-03-24 Thread David G. Johnston
On Sunday, March 23, 2025, Igor Korot wrote: > > 2. Is there a way to do CREATE TRIGGER IF NOT EXIST for the earlier > version? > No. You have to drop the trigger if it does exist and then create the new one. David J.

Re: Determine server version from psql script

2025-03-23 Thread David G. Johnston
On Sunday, March 23, 2025, David G. Johnston wrote: > On Sunday, March 23, 2025, Igor Korot wrote: > >> >> 2. Is there a way to do CREATE TRIGGER IF NOT EXIST for the earlier >> version? >> > > No. You have to drop the trigger if it does exist and then cr

Re: Determine server version from psql script

2025-03-23 Thread David G. Johnston
On Sunday, March 23, 2025, Igor Korot wrote: > > CREATE TRIGGER playersinleague_insert AFTER INSERT ON playersinleague > WHEN new.current_rank IS NULL > > When the syntax shows parentheses you are required to write them. [ WHEN ( *condition* ) ] David J.

Re: Best way to check if a table is empty

2025-03-23 Thread David G. Johnston
On Sunday, March 23, 2025, Christophe Pettus wrote: > > (And to be pedantic, #1 returns TRUE / FALSE while #2 returns / > NULL, so they aren't exactly equivalent. If you are able to handle / > NULL, you don't need the EXISTS clause.) > Leaving the limit in place, without exists #1 returns eit

Re: Determine server version from psql script

2025-03-23 Thread David G. Johnston
On Sunday, March 23, 2025, Pavel Stehule wrote: > Hi > > ne 23. 3. 2025 v 19:31 odesílatel Igor Korot napsal: > >> Hi, >> >> [code] >> SELECT current_setting('server_version_num')::int > 13 as v13 >> > > SELECT current_setting('server_version_num')::int > =14 as v14 > IOW, you can’t us

Re: Need help understanding has_function_privilege

2025-03-23 Thread David G. Johnston
On Friday, March 21, 2025, Cosimo Simeone wrote: > Hi, and thanks (both of you!) > Shouldn't the > create role my_user NOINHERIT; > avoid this? And since not, why? :-) > > We might need to improve documentation surrounding the public pseudo-role a bit. Since it’s not a true group role I suspect

Re: Determine server version from psql script

2025-03-22 Thread David G. Johnston
On Saturday, March 22, 2025, Igor Korot wrote: > > >> Is it actually running in psql? >> > > Yes, i run "psql - d draft -a -f > Then read the psql docs. Your version has \if and you’ll find server version listed as the available client variables. David J.

Re: After upgrading libpq, the same function(PQftype) call returns a different OID

2025-03-20 Thread David G. Johnston
On Thu, Mar 20, 2025 at 11:54 AM Tom Lane wrote: > =?utf-8?Q?=C3=81lvaro?= Herrera writes: > > That said, we could add a comment that makes this more obvious: > > ... > > This looks a tad redundant in pg_type.h itself, but makes the generated > > pg_type_d.h file more obvious: > > I think it's a

Re: After upgrading libpq, the same function(PQftype) call returns a different OID

2025-03-20 Thread David G. Johnston
On Thu, Mar 20, 2025 at 8:42 AM Sebastien Flaesch wrote: > > */** > * * Backwards compatibility for ancient random spellings of pg_type OID > macros.* > * * Don't use these names in new code.* > * */* > #define CASHOID MONEYOID > #define LSNOID PG_LSNOID > > #define BOOLOID 16 > #define BYTEAOID

Re: Need help understanding has_function_privilege

2025-03-20 Thread David G. Johnston
On Wednesday, March 19, 2025, Cosimo Simeone wrote: > > > true? > Well... Ok, "whatever"... I revoke it: > =# revoke execute on function my_schema.my_func(text) from my_user; > REVOKE > Roles can inherit privileges. my_user is inheriting its execute privilege from PUBLIC. You have to revoke a g

Re: The logic behind comparing generic vs. custom plan costs

2025-03-15 Thread David G. Johnston
On Sat, Mar 15, 2025 at 10:42 AM Justin Blank wrote: > My idea had been that even if the custom plans average higher cost > than the generic plan, it is still worth considering custom plans. If > 1 time in 5, the custom plan is 10% of the cost of the generic plan, > it doesn't matter if the avera

Re: Query optimization

2025-03-13 Thread David G. Johnston
On Thursday, March 13, 2025, Durgamahesh Manne wrote: > > > > > >

Re: Creating files with testdata

2025-03-11 Thread David G. Johnston
On Mon, Mar 10, 2025 at 12:17 PM H wrote: > There are tables referencing each other using randomly generated IDs, ie. > those IDs are not known until after the parent table row is inserted. > I just reserve half of the number space of bigint, the negatives, for test data and assign known IDs as

Re: exclusion constraint question

2025-03-08 Thread David G. Johnston
On Sat, Mar 8, 2025 at 12:01 PM Rhys A.D. Stewart wrote: > > CHECK (l_mug_id <> c_mug_id AND l_mug_id <> r_mug_id AND c_mug_id > <> r_mug_id), > EXCLUDE USING gist (l_mug_id WITH <>, c_mug_id WITH <>, r_mug_id > WITH <>) -- Not working as expected (or my expectations are wrong). > ); > >

Re: Messages o Terminal

2025-03-04 Thread David G. Johnston
On Tue, Mar 4, 2025 at 6:07 PM Igor Korot wrote: > [quote] > NOTICE: relation "abcatcol" already exists, skipping > [/quote] > > Is there any way to suppress this NOTICE message? > > Specifically, no. Any notice message, yes. https://www.postgresql.org/docs/current/runtime-config-client.html#RU

Re: Error on the query

2025-03-04 Thread David G. Johnston
On Tuesday, March 4, 2025, Igor Korot wrote: > > [code] > queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM > pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relname > = \'abcatc_x\' AND n.nspname = \'public\' ) THEN CREATE UNIQUE INDEX > \"abcatc_x\" ON \"abcatco

Re: Review my steps for rollback to restore point

2025-03-04 Thread David G. Johnston
On Tuesday, March 4, 2025, chandan Kumar wrote: > Thank you for your time and clarification. > Does PITR recreate database internally ? can i say it is not the same as > pg_restore or it is same as pg_restore plus applying WAL on top of it. I > am asking because can we revern DDL operations wi

Re: Review my steps for rollback to restore point

2025-03-04 Thread David G. Johnston
On Tuesday, March 4, 2025, chandan Kumar wrote: > Thank you for your answer. I want to clarify one more doubt. Can PITR be > achieved without applying Base Backup > The point-in-time you choose must be in the future relative to whatever data files you are applying WAL on top of. That is only

Re: create_immv issue on aws Ubuntu even after create extention

2025-03-01 Thread David G. Johnston
On Saturday, March 1, 2025, Krishnakant Mane wrote: > > Can you tell me how exactly should the syntax be? > https://www.postgresql.org/docs/current/ddl-schemas.html > Is my function definition wrong? > It isn’t a function definition, it is a function call. David J.

Re: create_immv issue on aws Ubuntu even after create extention

2025-03-01 Thread David G. Johnston
On Saturday, March 1, 2025, Krishnakant Mane wrote: > > pg_ivm | 1.10 | pg_catalog > > plpgsql | 1.0 | pg_catalog. > > > 2) show search_path; > "$user" public. > 3) \df *.create_immv > pgivm | create_immv | bigint | text, text | func. > Provide the outputs from the above three commands in your re

Re: Please implement a catch-all error handler per row, for COPY

2025-03-01 Thread David G. Johnston
On Sat, Mar 1, 2025 at 9:20 AM Tom Lane wrote: > me nefcanto writes: > > Can you please provide a row-level catch-all handler for the copy > command? > > Very unlikely to happen. COPY is not intended as a general purpose > ETL mechanism, and we don't want to load it down with features that > wo

Re: How to return seto records from seof record function?

2025-02-25 Thread David G. Johnston
On Tuesday, February 25, 2025, Олег Самойлов wrote: > Postgresql 17.2 > > How to return seto records from seof record function? I tried > pg_background extension: > > > *CREATE* *OR* *REPLACE* *FUNCTION* public.autonomous (p_script *text*) > > *RETURNS* *SETOF* record > > *LANGUAGE* plpgsql > > *

Re: Deleting idle connections

2025-02-24 Thread David G. Johnston
On Mon, Feb 24, 2025 at 3:50 PM Yongye Serkfem wrote: > > I am having a series of idle connections and unable to delete them with a > single command. Any help in realizing this would be greatly appreciated. > > "deleting" really isn't the word used to describe this, terminate, kill, or disconnect

Re: Default Value Retention After Dropping Default

2025-02-24 Thread David G. Johnston
On Mon, Feb 24, 2025 at 9:37 AM Adrian Klaver wrote: > On 2/24/25 03:50, Laurenz Albe wrote: > > On Mon, 2025-02-24 at 20:56 +1300, Marcelo Fernandes wrote: > >> I am experiencing an interesting behavior in PostgreSQL and would like > to seek > >> some clarification. > > > >> > >> Can anyone expl

Re: DROP ROLE as SUPERUSER

2025-02-21 Thread David G. Johnston
On Friday, February 21, 2025, Dominique Devienne wrote: > On Fri, Feb 21, 2025 at 3:33 PM Tom Lane wrote: > >> Dominique Devienne writes: >> > The point I'm trying to make, is that "hunting down" grantor(s) to >> connect >> > to DB(s) to be able to "force drop" a ROLE is a PITA. And I really wi

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread David G. Johnston
On Thu, Feb 20, 2025 at 9:21 AM Dominique Devienne wrote: > But that's not much better. It's basically like the SET ROLE to the > GRANTOR I did. > I guess what I want is GRANTED BY ANYONE! And not have to figure out > GRANTOR(s). > Your stated use case is dropping a role. Does the combination o

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread David G. Johnston
On Thursday, February 20, 2025, Dominique Devienne wrote: > Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE silently > did nothing, even with CASCADE, when I was running it as SUPERUSER, > preventing DROP'ing the ROLE. I had to manually SET ROLE to the GRANTOR, do > the REVOKE, wh

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread David G. Johnston
On Thu, Feb 20, 2025 at 9:05 AM Tom Lane wrote: > "David G. Johnston" writes: > > On Thursday, February 20, 2025, Dominique Devienne > > wrote: > >> Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE silently > >> did nothing, even with

Re: DROP ROLE as SUPERUSER

2025-02-20 Thread David G. Johnston
On Thursday, February 20, 2025, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thursday, February 20, 2025, Dominique Devienne > wrote: > >> Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE silently >> did nothing, even with CASCADE, when I

Re: Loading the latest N rows into the cache seems way too fast.

2025-02-17 Thread David G. Johnston
On Mon, Feb 17, 2025 at 2:41 PM Ron Johnson wrote: > On Mon, Feb 17, 2025 at 4:36 PM Tom Lane wrote: > >> Ron Johnson writes: >> > The bigint "id" column in "mytbl" is populated from a sequence, and so >> is >> > monotonically increasing: the newest records will have the biggest id >> > values.

Re: Clarification on Role Access Rights to Table Indexes

2025-02-17 Thread David G. Johnston
On Monday, February 17, 2025, Tom Lane wrote: > Ayush Vatsa writes: > > postgres=> SELECT pg_prewarm('pg_class_oid_index'); > > ERROR: permission denied for index pg_class_oid_index > > You'd really have to take that up with the author of pg_prewarm. This is our contrib module so this seems l

Clarification on Role Access Rights to Table Indexes

2025-02-17 Thread David G. Johnston
On Monday, February 17, 2025, Ayush Vatsa wrote: > postgres=# CREATE ROLE alpha; > > CREATE ROLE > postgres=# GRANT SELECT ON pg_class TO alpha; > This is pointless, everyone (i.e. the PUBLIC pseudo-role) can already read pg_class. 1. Can a role have access rights to a table without having acces

Re: Bash profile

2025-02-15 Thread David G. Johnston
On Sat, Feb 15, 2025 at 12:01 PM Yongye Serkfem wrote: > > I would appreciate any assistance with configuring the bash profile to run > two different postgresql versions. Specifically V12.7 and 15.7 > > Can you provide more detail on what you are trying to do, and why? Your request doesn't make

Re: PG-15.6: timeout parameters erroring out

2025-02-09 Thread David G. Johnston
On Sunday, February 9, 2025, Tom Lane wrote: > Mukesh Tanuku writes: > > We unabled the postgres timeout parameters in the postgresql.conf file > > > *idle_in_transaction_session_timeout = '1min'idle_session_timeout = > '5min'* > Did you actually run them together on one line like that? > I th

Re: PG-15.6: timeout parameters erroring out

2025-02-09 Thread David G. Johnston
On Sunday, February 9, 2025, Mukesh Tanuku wrote: > > > > *idle_in_transaction_session_timeout = '1min'idle_session_timeout = '5min'* > I suspect our docs may need an update. They say you may include white space before the unit; it probably needs to be changed to “must”. I believe we’ve recentl

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Rich Shepard wrote: > > I want to replace the old lookup table (with no FK) with this one. > Is the use of FK here intentional or a typo? Because everything written so far leads me to believe it should be PK. Pri,are key is the unique side, Foreign key is the usag

Re: Understanding ALTER DEFAULT PRIVILEGES Behavior in PostgreSQL

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Ayush Vatsa wrote: > > postgres=# ALTER DEFAULT PRIVILEGES IN SCHEMA my_schema REVOKE EXECUTE ON > FUNCTIONS FROM PUBLIC; > ALTER DEFAULT PRIVILEGES > As the documentation explains: Default privileges that are specified per-schema are added to whatever the global de

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Michał Kłeczek wrote: > > > On 4 Feb 2025, at 18:27, Thiemo Kellner > wrote: > > > >  Unless the lookup table is actually a check constraint one can use to > populate dropdown boxes in an interface. > > That is even worse because it ceases being transactional and u

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tue, Feb 4, 2025 at 9:31 AM Michał Kłeczek wrote: > > > > On 4 Feb 2025, at 15:27, Rich Shepard wrote: > > > > Should lookup tables have a numeric FK column as well as the description > column? > > > > If so, how should I add an FK to the two lookup tables in my database? > > I’ve read the wh

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Rich Shepard wrote: > On Tue, 4 Feb 2025, David G. Johnston wrote: > > The point of a lookup table is to provide a unique list of authoritative >> values for some purpose. Kinda like an enum. But having the label serve as >> the unique value is

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Ron Johnson wrote: > On Tue, Feb 4, 2025 at 9:28 AM Rich Shepard > wrote: > >> Should lookup tables have a numeric FK column as well as the description >> column? >> > > Does your lookup table just have one column? (That's what your question > seems to imply, but t

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Ron Johnson wrote: > On Tue, Feb 4, 2025 at 9:41 AM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Tuesday, February 4, 2025, Rich Shepard >> wrote: >> >>> Should lookup tables have a numeric FK co

Re: Lookup tables

2025-02-04 Thread David G. Johnston
On Tuesday, February 4, 2025, Rich Shepard wrote: > Should lookup tables have a numeric FK column as well as the description > column? > > If so, how should I add an FK to the two lookup tables in my database? > Most do (have a surrogate PK) since it removes cascading updates and is a smaller va

Re: Using psql's \prompt command

2025-01-30 Thread David G. Johnston
On Thu, Jan 30, 2025 at 3:46 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Jan 30, 2025 at 3:44 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Thu, Jan 30, 2025 at 3:38 PM Rich Shepard >> wrote: >> >

Re: Using psql's \prompt command

2025-01-30 Thread David G. Johnston
On Thu, Jan 30, 2025 at 3:44 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Jan 30, 2025 at 3:38 PM Rich Shepard > wrote: > >> On Thu, 30 Jan 2025, Rich Shepard wrote: >> >> > Thank you. I'll look into using the \set command. >>

Re: Using psql's \prompt command

2025-01-30 Thread David G. Johnston
On Thu, Jan 30, 2025 at 3:38 PM Rich Shepard wrote: > On Thu, 30 Jan 2025, Rich Shepard wrote: > > > Thank you. I'll look into using the \set command. > > My web searches find many examples of using the \set command, but none > getting user input with \prompt. > > Please point me to a reference w

Re: Using psql's \prompt command

2025-01-30 Thread David G. Johnston
On Thursday, January 30, 2025, Rich Shepard wrote: > > > What's the correct syntax for the \prompt? > Prompt isn’t your issue. Prompt stores the value into a variable. Read how to reference variables in a psql script. David J.

Re: Meaning of + symbol at end of column string

2025-01-22 Thread David G. Johnston
On Wednesday, January 22, 2025, Rich Shepard wrote: > I use scripts to enter new rows in tables yet on rare occasions when I > select all columns from a table I'll find a "+" at the end of a string > value in one column. My web search finds no explanation. > > What does that + symbol mean in this

Re: Automatic deletion of orphaned rows

2025-01-22 Thread David G. Johnston
On Wednesday, January 22, 2025, Ron Johnson wrote: > > >> I therefore propose a feature, to be able to specify in a table schema >> that a row should be deleted if orphaned. > > > For one thing, rows *can't* be orphaned if there's a foreign key > reference. > The description was correct even thou

concatenating hstores in a group by?

2025-01-19 Thread David G. Johnston
On Friday, January 17, 2025, Brent Wood wrote: > > I want to concatenate the hstores, > > There are no hstore aggregate functions. You’ll want to convert them to,json first then use the json_objectagg aggregate function. David J.

Re: Issue with Password Authentication for Pgpool

2025-01-08 Thread David G. Johnston
On Wednesday, January 8, 2025, vijay patil wrote: > Pgpool needs to be restarted for the changes to take effect. > You should look for and leverage the difference between when something must be “restarted” and when it has provided a mechanism for “reloading”. David J.

Re: Issue with Password Authentication for Pgpool

2025-01-08 Thread David G. Johnston
On Wednesday, January 8, 2025, vijay patil wrote: > This behavior might be related to how Pgpool handles authentication. > Having never used pgpool I very well could be wrong but from what I can gather what you want to do is simply not possible within the current design of pgpool. Namely you ha

Re: Issue with Password Authentication for Pgpool

2025-01-08 Thread David G. Johnston
On Wednesday, January 8, 2025, vijay patil wrote: > Could you please advise how I can achieve password authentication without > using the pool_password file, while ensuring that Pgpool prompts for the > password during connection? > https://www.pgpool.net/docs/latest/en/html/runtime-config-conne

Re: Postgres do not support tinyint?

2025-01-07 Thread David G. Johnston
On Tuesday, January 7, 2025, Ron Johnson wrote: > > 3. The "bit" type might serve your needs. > > You suggest a type with a minimum size of 6 bytes when the complaint is that the otherwise acceptable 2 byte data type is too large? David J.

Re: Query related to Logical Replication using test_decoding and unchanged-toast-datum

2025-01-06 Thread David G. Johnston
On Mon, Jan 6, 2025 at 7:21 AM Kiran K V wrote: > could you please tell me whether PostgreSQL will truly log these values to > WAL or not ? If not, what will be entered into WAL for the JSON column if > it remains unchanged? > > Not quite sure what you are looking for but: https://www.postgresql

Re: search_path for PL/pgSQL functions partially cached?

2025-01-04 Thread David G. Johnston
On Saturday, January 4, 2025, Jan Behrens wrote: > > I re-read section 41.11.2. on Plan Caching: > > "The PL/pgSQL interpreter parses the function's source text and > produces an internal binary instruction tree the first time the > function is called (within each session). The instruction tree f

Re: search_path for PL/pgSQL functions partially cached?

2025-01-04 Thread David G. Johnston
On Saturday, January 4, 2025, Jan Behrens wrote: > > CREATE FUNCTION "foo_impl"("query_p" TEXT, "search_path_p" TEXT) > RETURNS "some_type" > LANGUAGE plpgsql SET search_path FROM CURRENT AS $$ > DECLARE > "old_search_path" TEXT; > "result" "some_type"; > BEGIN > "ol

Re: search_path for PL/pgSQL functions partially cached?

2025-01-04 Thread David G. Johnston
On Saturday, January 4, 2025, Jan Behrens wrote: > > > Even if > > DECLARE "variable" "tbl"."col"%TYPE; > > follows *after* the schema is set to "myschema" in the example above, I > still get differing results, depending on how the search_path was set > when the function was first called. > > I th

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread David G. Johnston
On Fri, Jan 3, 2025 at 2:33 PM Jan Behrens wrote: > I would prefer my current solution, but I would like to be sure that my > example (the one in my e-mail dated Fri, 3 Jan 2025 13:53:32 +0100) is > correct. I still am not sure about that. > > If it does what you want and it is only ever executed

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread David G. Johnston
On Fri, Jan 3, 2025 at 9:48 AM Jan Behrens wrote: > On Fri, 3 Jan 2025 08:34:57 -0700 > "David G. Johnston" wrote: > > > On Friday, January 3, 2025, Jan Behrens wrote: > > > > > > I would like to know if the above example is correct. It seems overal

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread David G. Johnston
On Friday, January 3, 2025, Jan Behrens wrote: > > I would like to know if the above example is correct. It seems overall > bulky, but I haven't found a better way, assuming that it can be > unknown where a particular extension has been installed to. In > particular I feel a bit insecure about whe

Re: search_path for PL/pgSQL functions partially cached?

2025-01-01 Thread David G. Johnston
On Wed, Jan 1, 2025 at 10:55 AM Jan Behrens wrote: > On Sat, 28 Dec 2024 00:40:09 +0100 > Jan Behrens wrote: > > > On Fri, 27 Dec 2024 13:26:28 -0700 > > "David G. Johnston" wrote: > > > > > > Or is it documented somewhere? > > &g

Re: Initial Postgres admin account setup using Ansible?

2024-12-31 Thread David G. Johnston
On Tue, Dec 31, 2024 at 5:17 PM Nick wrote: > > ``` > localall all peer map=ansible_map > ``` > > > In `pg_ident.conf`, add: > > ``` > ansible_map ansible postgres > ansible_map postgrespostgres > > ``` > > > This seems to work,

  1   2   3   4   5   6   7   8   9   10   >