Re: table returning function for each row in other resultset

2021-02-03 Thread David G. Johnston
On Wed, Feb 3, 2021 at 8:01 AM Niels Jespersen wrote: > Hello all > > I have som data in a resultset. E.g: > > id date_begin date_end amount > 1 2021-01-04 2021-02-06 100 > 2 2021-03-17 2021-05-11 234 > > I have a table returning function that can take one row and split it into >

Re: index unique

2021-06-08 Thread David G. Johnston
On Tuesday, June 8, 2021, Marc Millas wrote: > > but as this looks quite hard coded, it means that for long utf8 things > the data length is not so long before hitting the limit. > > is there any plan to adress this ? > None that I’ve seen, and I don’t expect to see one either. Mainly because

Re: Database issues when adding GUI

2021-06-07 Thread David G. Johnston
On Mon, Jun 7, 2021 at 9:36 AM Rich Shepard wrote: > On Mon, 7 Jun 2021, Tom Lane wrote: > > > We removed the pg_attrdef.adsrc catalog column a couple versions back. > > You're evidently using quite an old version of whichever client-side > > library is issuing this command. You need to get a

Re: index unique

2021-06-07 Thread David G. Johnston
On Sun, Jun 6, 2021 at 11:55 PM Peter J. Holzer wrote: > On 2021-06-03 22:51:55 +0200, Marc Millas wrote: > > postgres 12 with postgis. > > on a table we need a primary key and to get a unique combinaison, we > need 3 > > columns of that table: > > 1 of type integer, > > 1 of type text, > > 1 of

Re: Database issues when adding GUI

2021-06-07 Thread David G. Johnston
On Mon, Jun 7, 2021 at 10:20 AM Rich Shepard wrote: > On Mon, 7 Jun 2021, David G. Johnston wrote: > > > Those are PostgreSQL versions...but it's your non-psql client software > > that needs upgrading, not PostgreSQL. > > David, > > Ah! Now I understand. > Apparently you do not...? David J.

Re: Database issues when adding GUI

2021-06-07 Thread David G. Johnston
On Mon, Jun 7, 2021 at 2:26 PM Rich Shepard wrote: > On Mon, 7 Jun 2021, Tom Lane wrote: > > > We removed the pg_attrdef.adsrc catalog column a couple versions back. > > You're evidently using quite an old version of whichever client-side > > library is issuing this command. You need to get a

Re: Database issues when adding GUI

2021-06-07 Thread David G. Johnston
On Monday, June 7, 2021, Adrian Klaver wrote: > I'm guessing qt5-5.12.8 is not recent enough to deal with the changes in > Postgres 11+. You might want to ask this on the Qt list(s). I have tried to > determine this, but the Qt repo structure is lets say interesting and I > can't find any

Re: Is there a way to replace select * fields in result ?

2021-06-12 Thread David G. Johnston
On Saturday, June 12, 2021, Condor wrote: > > Hello, > > Is there a way to replace select * fileds in result ? > I have select qw.* from table but I want field for example mm to be > replaced with custom value like: > > select qw.*, case whem length(qw.mm) > 0 THEN COALESCE(SUBSTRING(qw.mm, > 1,

Re: Logical Replication: SELECT pg_catalog.set_config Statement appears to be hanging

2021-06-10 Thread David G. Johnston
On Thu, Jun 10, 2021, 09:06 Hannes Kühtreiber wrote: > so we have to wait for psql14, or is there something else to this effect > in an earlier release, that I failed to find? > By definition every feature in a vX.0 release note is new as of that release. The sentence at the top of that

Re: A simple question about text fields

2021-06-17 Thread David G. Johnston
On Thursday, June 17, 2021, Gavan Schneider wrote: > > My approach is to define such fields as ‘text’ and set a constraint using > char_length(). This allows PG to do the business with the text in native > form, and only imposes the cost of any length check when the field is > updated… best of

Re: Temporal tables as part of main release

2021-06-18 Thread David G. Johnston
On Thursday, June 17, 2021, Anand Sowmithiran wrote: > I am looking to use the temporal tables feature for keeping track of > changes to my table data. As of now, there is an pgxn.org provided > extension by which we could leverage this functionality, but *when > Temporal tables will become part

Re: replace inside regexp_replace

2021-06-21 Thread David G. Johnston
On Monday, June 21, 2021, Oliver Kohll wrote: > > select regexp_replace( > 'here is [[my text]] to replace and [[some more]]', > E'\\[\\[(.*?)\\]\\]', > replace(E'\\1', ' ', '_'), > 'g' > ); > Side note, you seldom want to use “E” (escape) string literals with regexes (or in general really)

Re: immutable function querying table for partitioning

2021-06-15 Thread David G. Johnston
On Tuesday, June 15, 2021, Vijaykumar Jain wrote: > > > --- now since the lookup table is update, a noop update would get new > shards for ids and rebalance them accordingly. > > test=# update t set id = id ; > UPDATE 25 > You probably avoid the complications by doing the above, but the amount

Re:

2021-05-17 Thread David G. Johnston
On Sunday, May 16, 2021, Loles wrote: > I don't understand why the server starts that process if I'm not using > replication of any kind. > > > The server starts it with the default configuration of version 13. > > I think that it consumes resources that I do not need because, as I have >

Re:

2021-05-18 Thread David G. Johnston
On Mon, May 17, 2021 at 7:13 AM Tom Lane wrote: > "David G. Johnston" writes: > > On Monday, May 17, 2021, Tom Lane wrote: > >> It looks like it won't be started if you set > >> max_logical_replication_workers = 0. > > > I was wondering about th

Re:

2021-05-18 Thread David G. Johnston
On Tue, May 18, 2021 at 6:46 AM Tom Lane wrote: > "David G. Johnston" writes: > > > as well as the fact that 0 disables the logical replication > > subscribing feature altogether, and precludes the background worker > > scheduler process from launchi

Re: Strange behavior of function date_trunc

2021-05-06 Thread David G. Johnston
On Thu, May 6, 2021 at 6:44 AM Tom Lane wrote: > This case is the reason we invented the "stable" attribute to begin > with. People have since misinterpreted it as authorizing caching of > function results, but that's not what it was intended for. > > This is a good paragraph...if something

Re: Issue in PG start

2021-05-07 Thread David G. Johnston
On Friday, May 7, 2021, sivapostg...@yahoo.com wrote: > Hello, > > PG 11.8 in Windows 10 and currently PG 11.11 > > Yesterday [07th May] morning when we switched on the computer and > subsequently PGAdmin, we got the message following message > FATAL: the database system is starting up > > I

Re:

2021-05-17 Thread David G. Johnston
On Monday, May 17, 2021, Tom Lane wrote: > "David G. Johnston" writes: > > On Sunday, May 16, 2021, Loles wrote: > >> I don't understand why the server starts that process if I'm not using > >> replication of any kind. > > > It starts the p

Re: Postgres upgrade 12 - issues with OIDs

2021-05-15 Thread David G. Johnston
On Saturday, May 15, 2021, Venkata B Nagothi wrote: > > > *ERROR: column c.relhaspkey does not exist at character 33* > > Below is the query generating the error : > > STATEMENT: SELECT c.relname AS table_name, c.relhaspkey AS > has_primary_key FROM pg_catalog.pg_class c,

Re: The contents of the pg_timezone_names view bring some surprises

2021-05-19 Thread David G. Johnston
On Tuesday, May 18, 2021, Bryn Llewellyn wrote: > Some time zones have abbreviations that are identical to their names. This > query: > > Am I missing an essential clue to resolving what seems to me to be a > paradox? Or am I seeing two kinds of bug? > > You are missing the material in appendix

Re: RETURNING, CTEs and TRANSACTION ISOLATION levels...

2021-05-14 Thread David G. Johnston
On Fri, May 14, 2021 at 8:33 AM Pól Ua Laoínecháin wrote: > > I was able to do it by chaining CTEs - but I wanted to be sure that > when chaining CTEs, all work done in a statement with multiple > modifications to data was done within the same transaction - this is > what I thought my SQL would

Re: Same column names in a subresult table

2021-05-14 Thread David G. Johnston
On Friday, May 14, 2021, Durumdara wrote: > > Is there any way to suppress the original field? > Remove the star and list the other columns you do want. > > Or say to PGSQL to skip the first XDate field? > > Like select t.* (EXCEPT XDate) from t > No, though I’ve expressed a desire for this

Question about integer out of range in function

2021-05-16 Thread David G. Johnston
On Sunday, May 16, 2021, Condor wrote: > > new_time = fromtime * 1000; -- here is line 19 > > An integer times an integer results in an integer. Period. Neither fromtime nor new_time have been assigned to yet, the in-memory result of the computation is only allocated integer bits and if

Re: Overriding natural order of query results for a subset

2021-05-29 Thread David G. Johnston
On Saturday, May 29, 2021, Laura Smith wrote: > > The problem is that my use-case calls for a scenario where due to protocol > certain people may be designated as "VIP" and therefore need to appear at > the top. In addition, protocol may dictate that those "VIP" people > themselves may

Re: syntax question

2021-06-03 Thread David G. Johnston
On Thu, Jun 3, 2021 at 1:02 PM Marc Millas wrote: > about knowing if I should... > We have to create a set of triggers (insert, update, delete) within a huge > set of tables. and that list of tables, and structure of them can be > customized, maintained, ... > so we were looking for a standard

Re: EXPLAIN with anonymous DO block?

2021-07-01 Thread David G. Johnston
On Thu, Jul 1, 2021 at 9:22 AM Michael Lewis wrote: > It sounds like you are wanting to run 'explain analyze [query]' inside a > loop inside a DO block. That isn't possible as far as I know, but > auto_explain and log_nested_statements should be able to let you profile > the whole thing and

Re: Use case stuck due to Partitioning

2021-06-28 Thread David G. Johnston
On Mon, Jun 28, 2021 at 2:51 PM Michael Lewis wrote: > I am unclear exactly what you want to do with modified_date. Can you write > pseudo code perhaps? > > I second this. While I'm not all that familiar with partitioning I am readily getting the feeling that whether or not partitioning is used

Re: GIN indexed unique constraint?

2021-06-27 Thread David G. Johnston
On Sun, Jun 27, 2021 at 11:18 AM Allan Kamau wrote: > Is it possible to declare a UNIQUE constraint that uses GIN indexing? > > Doesn't seem to be possible. The btree_gin extension would provide the necessary code but it states explicitly that: "... and they lack one major feature of the

Undocumented array_val[generate_series(...)] functionality?

2021-07-11 Thread David G. Johnston
Hey, A post over in Reddit had an expression form I've never seen before: select (array[1,2,3,4]::integer[])[generate_series(1, 3)]; === 1 2 3 Looking at subscripting in the SQL syntax this example doesn't seem to be documented.

Re: Undocumented array_val[generate_series(...)] functionality?

2021-07-11 Thread David G. Johnston
On Sun, Jul 11, 2021 at 5:43 PM David Rowley wrote: > Isn't this implied by "Each subscript is itself an expression"? > There's nothing special here with the SRF. That just produces 3 rows > and passes the subscript as 1, 2 then 3. > > One can indeed infer that if the expression chosen for

Re: Undocumented array_val[generate_series(...)] functionality?

2021-07-11 Thread David G. Johnston
On Sun, Jul 11, 2021 at 6:06 PM David Rowley wrote: > select abs(generate_series(-3,-1)); > > abs() is simply called once per output value of the generate_series > SRF. That seems fairly equivalent to me to what's going on in your > example case. > > Fair point. Both of these are premised on

Re: Undocumented array_val[generate_series(...)] functionality?

2021-07-12 Thread David G. Johnston
On Monday, July 12, 2021, Tom Lane wrote: > Still, I'm with David that no new docs > are needed. IMO the former restriction was the surprising thing, and > the current behavior is simply what one would expect from assembling > those parts in that order. > > I agree the material in Extending SQL

Re: On partitioning, PKs and FKs

2021-07-09 Thread David G. Johnston
On Thursday, July 8, 2021, Wiwwo Staff wrote: > On Thu, 8 Jul 2021 at 21:42, Alban Hertroys com> wrote: > >> On 2021-07-08 13:30, Ron wrote: >> > Thus, the bigTable PK must be on id, columnX, (No, I don't like it >> > either.) >> >> That's not entirely true. You can keep the PK on id if you

Re: pg_dump's restore gives "operator does not exist: public.iprange = public.iprange" but copy paste works

2021-07-08 Thread David G. Johnston
On Thu, Jul 8, 2021 at 12:51 PM Christopher Causer wrote: > > ``` > SELECT pg_catalog.set_config('search_path', '', false); > ``` > The data types you are using exist in the public schema. I must assume the associated equality operator also exists in the public schema. So, when the

Re: pg_dump's restore gives "operator does not exist: public.iprange = public.iprange" but copy paste works

2021-07-08 Thread David G. Johnston
On Thu, Jul 8, 2021 at 1:09 PM Tom Lane wrote: > This isn't the only SQL syntax that has implicit operators; CASE is > another example, and I think there are more. We've discussed inventing > non-SQL-spec syntax that can cope with explicitly writing a qualified > operator name in all these

Re: pg_dump's restore gives "operator does not exist: public.iprange = public.iprange" but copy paste works

2021-07-08 Thread David G. Johnston
On Thu, Jul 8, 2021 at 1:29 PM Tom Lane wrote: > So the problem is not lack of a server feature, it's persuading pg_dump > to emit something other than what it does now. > So basically a different variation on the let someone else who feels hot enough about it and is able to code in C figure

Re: pg_dump's restore gives "operator does not exist: public.iprange = public.iprange" but copy paste works

2021-07-08 Thread David G. Johnston
On Thu, Jul 8, 2021 at 1:09 PM Tom Lane wrote: > > I don't think there's any good solution right now. > For joins it is generally easy enough to resort to the ON clause instead of USING so of the various places there are problems this is probably the least. I'll admit these have been

Re: pg_dump's restore gives "operator does not exist: public.iprange = public.iprange" but copy paste works

2021-07-08 Thread David G. Johnston
On Thu, Jul 8, 2021 at 1:09 PM Tom Lane wrote: > > This isn't the only SQL syntax that has implicit operators; CASE is > another example, and I think there are more. We've discussed inventing > non-SQL-spec syntax that can cope with explicitly writing a qualified > operator name in all these

Re: Partition Creation Permissions

2021-02-04 Thread David G. Johnston
On Thu, Feb 4, 2021 at 3:39 PM Samuel Nelson wrote: > I've been trying to restrict permissions of some users in our system and > noticed that `create table foo partition of bar for values from (x) to (y)` > complains that I must be the owner of the table. Is there another GRANT I > can give to

Re: need clarification on CTE/join

2021-03-23 Thread David G. Johnston
On Tue, Mar 23, 2021 at 6:45 PM Marc Millas wrote: > So.. I would like to understand the "why" of this behaviour, ie. the > change of order when I do the cast. > I believe the "why" is immaterial here. Your queries do not contain order by so your results are unordered - even if there appears

Re: need clarification on CTE/join

2021-03-23 Thread David G. Johnston
On Tuesday, March 23, 2021, Marc Millas wrote: > Hi, > > I cannot agree. > I did an explain analyze with and without the cast: its > extremely different: > > postgres=# explain analyze with numb as(select ceiling(2582*random())::int > rand, generate_series(1,5) as monnum) select monnum, prenom

Re: Dangerous Naming Confusion

2021-03-29 Thread David G. Johnston
On Mon, Mar 29, 2021 at 3:20 PM Adrian Klaver wrote: > On 3/29/21 3:00 PM, Don Seiler wrote: > > > > I'm wondering if this is expected behavior that PG uses the > > dts_orders.order_id value in the subquery "select order_id from > > dts_temp" when dts_temp doesn't have its own order_id column. I

Re: Upgrading from 11 to 13

2021-03-30 Thread David G. Johnston
On Tue, Mar 30, 2021 at 8:25 AM Daniel Westermann (DWE) < daniel.westerm...@dbi-services.com> wrote: > >On Tue, Mar 30, 2021 at 08:10:08AM -0700, Adrian Klaver wrote: > >> On 3/30/21 8:06 AM, Bruce Momjian wrote: > >> > What other software needs to upgrade through all intermediate > versions? >

Re: How to implement expiration in PostgreSQL?

2021-04-01 Thread David G. Johnston
On Thu, Apr 1, 2021 at 7:23 AM Glen Huang wrote: > > I'd say that was onerous and you could get the same effect with a > well-crafted query that targetted only those that might possibly expire. > > I wish one cron job could rule them all, but since a person can decide to > join at any time, her

Re: hstore each() function - returned order??

2021-03-12 Thread David G. Johnston
On Fri, Mar 12, 2021 at 3:18 AM Brent Wood wrote: > *From:* David G. Johnston > *Sent:* Friday, March 12, 2021 21:19 > *To:* Brent Wood > *Cc:* pgsql-general@lists.postgresql.org < > pgsql-general@lists.postgresql.org> > *Subject:* Re: hstore each() function - retur

Re: Error message

2021-03-15 Thread David G. Johnston
On Monday, March 15, 2021, Igor Korot wrote: > > [quote] > As with PQexec, the result is normally a PGresult object whose > contents indicate server-side success or failure. A null result > indicates out-of-memory or inability to send the command at all. Use > PQerrorMessage to get more

Re: Need help with clarification on stored procedure support in PostGreSQL database

2021-03-10 Thread David G. Johnston
On Tue, Mar 9, 2021 at 5:18 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Tue, Mar 9, 2021 at 4:50 PM Tom Lane wrote: > >> Would it be better > >> to turn the para into a bulleted list, which we could introduce with > >> "The key d

Re: unexpected character used as group separator by to_char

2021-03-09 Thread David G. Johnston
On Tue, Mar 9, 2021 at 1:28 PM Vincent Veyron wrote: > For the record below, I wish to display 'credit' properly formated in an > html form, using to_char(credit, 'FM999G990D00') > > ^ > What can I do to get a standard space as group separator for

Re: Example 31-2. libpq Example Program 2

2021-03-10 Thread David G. Johnston
On Wednesday, March 10, 2021, Niko Ware wrote: > > > I modified the code to include the "extra" member in the following > statement: > > fprintf(stderr, > "ASYNC NOTIFY of '%s' received from backend PID %d: > %s\n", > notify->relname, notify->be_pid,

Re: hstore each() function - returned order??

2021-03-12 Thread David G. Johnston
On Thursday, March 11, 2021, Brent Wood wrote: > Hi, > > I'm using the following in an SQL : > > select (EACH(value)).key as measurement_key, >(EACH(value)).value as value > from t_reading_hstore; > > Just move the each call to the from clause as a lateral join and treat the result as a

Re: Compare with default value?

2021-03-13 Thread David G. Johnston
On Saturday, March 13, 2021, Ulrich Goebel wrote: > > I would like to get the rows, where a column has the default value, > similar to: > > select id fromt tbl where col = default > If the default is a simple constant then why go through the trouble instead of just writing col = ‘constant’ ?

Re: Compare with default value?

2021-03-13 Thread David G. Johnston
On Sat, Mar 13, 2021 at 1:41 PM Ulrich Goebel wrote: > But it could help to get a reference to the default value. > There is no such thing as a "default value". There is a "default expression" though. It should be available in the system catalogs as part of the definition of a table. But I'm

Re: Allowing John to Drop Triggers On Chad's Tables

2021-03-15 Thread David G. Johnston
On Mon, Mar 15, 2021 at 12:20 PM Fred Habash wrote: > If there is a 'grant trigger' why is there not a 'grant drop trigger'? > > Because creating a trigger from scratch doesn't let you affect other triggers that you may not own (at least not directly). If drop permissions were grantable the

Re: Need help with clarification on stored procedure support in PostGreSQL database

2021-03-09 Thread David G. Johnston
On Tue, Mar 9, 2021 at 3:21 PM Tom Lane wrote: > "David G. Johnston" writes: > > The omission of the "OUT" parameter mode seems intentional since at > present > > our procedures do not support OUT mode parameters. > > Um, I just created one.

Re: Need help with clarification on stored procedure support in PostGreSQL database

2021-03-09 Thread David G. Johnston
On Tue, Mar 9, 2021 at 1:57 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Mon, Mar 8, 2021 at 9:41 PM Tom Lane wrote: > >> Guyren Howe writes: > >>> This seems like an important consideration. I've spent 10 minutes > >>> search

Re: Need help with clarification on stored procedure support in PostGreSQL database

2021-03-09 Thread David G. Johnston
On Tue, Mar 9, 2021 at 4:50 PM Tom Lane wrote: > I very strongly dislike the existing "The difference ..." wording, > because it implies that that's the only difference, which is immediately > belied by the rest. Agreed! > Would it be better > to turn the para into a bulleted list, which we

Re: Need help with clarification on stored procedure support in PostGreSQL database

2021-03-07 Thread David G. Johnston
On Sun, Mar 7, 2021 at 11:49 AM Bysani, Ram wrote: > Please provide details / clarify if Stored Procedures are available in > versions 11.x, 12.x, 13.x Please also confirm when it was actually added. > > https://www.postgresql.org/docs/ >

Re: Need help with clarification on stored procedure support in PostGreSQL database

2021-03-08 Thread David G. Johnston
On Mon, Mar 8, 2021 at 9:41 PM Tom Lane wrote: > Guyren Howe writes: > > This seems like an important consideration. I’ve spent 10 minutes > searching the documentation for PG 11 and can’t find where it is > documented. Perhaps it should be made more prominent? > >

Re: PostgreSQL Licensing Question for pg_crypto and tablefunc extensions

2021-02-26 Thread David G. Johnston
On Fri, Feb 26, 2021 at 12:01 PM Adrian Klaver wrote: > Which refers to COPYRIGHT: > > > https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=COPYRIGHT;h=655a3c59d60f54a824cc8ad6c94a4522f2b465cd;hb=HEAD > > The COPYRIGHT file indeed is serving as the in-repo documentation of our license.

Re: The Amazon CloudFront distribution is configured to block access from your country.

2021-04-12 Thread David G. Johnston
On Mon, Apr 12, 2021 at 1:33 AM Magnus Hagander wrote: > > Yeah, this is definitely something we could work on improving. Would > just adding a sentence after the link saying "This download is > provided externally by EDB" (very much open to input on exactly what > the sentence should be)? Or

Re: Reuse of REF Cursor

2021-04-11 Thread David G. Johnston
On Sunday, April 11, 2021, Abraham, Danny wrote: > > PG Version 9.5.5 on Linux. > > As neither your minor nor major version are supported you will find support to find limited if you get any at all. David J.

Re: The Amazon CloudFront distribution is configured to block access from your country.

2021-04-11 Thread David G. Johnston
On Sunday, April 11, 2021, Ron wrote: > > Your comment means that the owners of any web page which links to a third > party product must support that third-party product, just by virtue of > supporting it. That's crazy. > > We could do a better job on making it clear that the community project

Re: How can I insert the image as a blob in the table

2021-04-11 Thread David G. Johnston
On Sun, Apr 11, 2021 at 2:04 PM Igor Korot wrote: > Hi, ALL, > I have an image on my hard drive and I'd like to store it in the BLOB > column of the images table. > > Is there a simple SQL to do that in PostgreSQL? > > SQL proper has no concept of "your hard drive". You need to define what you

Re: How can I insert the image as a blob in the table

2021-04-11 Thread David G. Johnston
On Sunday, April 11, 2021, Igor Korot wrote: > Hi, David, > > > On Sun, Apr 11, 2021 at 6:24 PM David G. Johnston > wrote: > > > If you can decide on what client interface you want to use there should > be existing resources on the web walking through how to

Re: How can I insert the image as a blob in the table

2021-04-11 Thread David G. Johnston
On Sunday, April 11, 2021, David G. Johnston wrote: > On Sunday, April 11, 2021, Igor Korot wrote: > >> Hi, David, >> >> >> On Sun, Apr 11, 2021 at 6:24 PM David G. Johnston >> wrote: >> >> > If you can decide on what client interface yo

Re: Set a specific database to log_statement='ddl' but others to be log_statement='all'

2021-02-15 Thread David G. Johnston
On Monday, February 15, 2021, Abdul Qoyyuum wrote: > Hi all, > > I have a Postgresql cluster with master and multiple slaves running on > version 9.6. I'm trying to adjust the log_statement from all to ddl on > specific databases (i.e. postgresql.conf has log_statement='all' but I need > a

Re: How to return a jsonb list of lists (with integers)

2021-02-16 Thread David G. Johnston
On Tue, Feb 16, 2021 at 11:47 AM Alexander Farber < alexander.far...@gmail.com> wrote: > Thank you for any hints > > json_build_array(...) David J.

Re: Order by not working

2021-02-16 Thread David G. Johnston
On Tuesday, February 16, 2021, Dan Nessett wrote: > Thanks Peter. The listing of the result is from pg-admin 4.30 using > view/edit data applied to the household_data table. In the past this has > always returned the table contents in the ORDR BY sort order. Do I need to > specify some

Re: How to return a jsonb list of lists (with integers)

2021-02-16 Thread David G. Johnston
On Tuesday, February 16, 2021, Alexander Farber wrote: > > But is it possible in SQL to combine all 3 queries, so that a JSONB list > of lists is returned? > So I have to use PL/PgSQL, correct? > With liberal usage of CTEs and subqueries writing a single SQL query should be doable. David J.

Re: Syntax checking DO blocks and ALTER TABLE statements?

2021-02-16 Thread David G. Johnston
On Tue, Feb 16, 2021 at 3:43 PM Ron wrote: > > How does one go about syntax checking this? > > (There are 222 ALTER TABLE ADD FOREIGN KEY statements that I'm wrapping in > similar DO blocks, and want to make sure the statements are clean.) > > Begin a transaction, execute the DO, capture an

Re: Syntax checking DO blocks and ALTER TABLE statements?

2021-02-16 Thread David G. Johnston
On Tue, Feb 16, 2021 at 4:28 PM Tim Cross wrote: > > David G. Johnston writes: > > > On Tue, Feb 16, 2021 at 3:43 PM Ron wrote: > > > >> > >> How does one go about syntax checking this? > >> > >> (There are 222 ALTER TABLE ADD FORE

Re: append jsonb array to another jsonb array

2021-02-17 Thread David G. Johnston
On Wednesday, February 17, 2021, Joao Miguel Ferreira < joao.miguel.c.ferre...@gmail.com> wrote: > We are using Pg 11. > > Example: > a = [ x, y ] > b = [ z , w ] > result would be [ x, y, z, w ] > > What would you consider to be a suitable approach ? > That’s called concatenation.

Re: prepare in a do loop

2021-02-15 Thread David G. Johnston
On Mon, Feb 15, 2021 at 9:19 AM Marc Millas wrote: > > postgres=# prepare moninsert(varchar) as > > do $$ begin for counter in 1..100 loop execute > moninsert(randname());end loop;end;$$; > ERREUR: la fonction moninsert(character varying) n'existe pas > someone can explain ? > > >From the

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-20 Thread David G. Johnston
On Sat, Feb 20, 2021 at 11:46 AM Alexander Farber < alexander.far...@gmail.com> wrote: > Then I have to split the query in 3 similar ones (with same condition)? > > I try: > > SELECT > JSONB_AGG(TO_CHAR(finished, '-MM-DD')) AS day > FROM words_games > WHERE

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-20 Thread David G. Johnston
On Sat, Feb 20, 2021 at 12:34 PM Alexander Farber < alexander.far...@gmail.com> wrote: > Ah, thank you... > > JSON support in PostgreSQL is cool and seems to be extended with each > release. > > But standard tasks of returning a JSON map of lists or JSON list of list > seem to be difficult to

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-20 Thread David G. Johnston
On Sat, Feb 20, 2021 at 11:39 AM Alexander Farber < alexander.far...@gmail.com> wrote: > > Or is the syntax error about being able to use JSONB_AGG only once per > SELECT query? > > That. David J.

Re: How to determine server's own IP address? inet_server_addr not working

2021-02-21 Thread David G. Johnston
On Sun, Feb 21, 2021 at 4:38 PM Guyren Howe wrote: > The documentation says that inet_server_addr() does this, but on our > servers it is returning nothing. > "Returns the IP address on which the server accepted the current connection, or NULL if the current connection is via a Unix-domain

Re: Consequence of changes to CTE's in 12

2021-02-11 Thread David G. Johnston
On Thu, Feb 11, 2021 at 5:07 PM Steve Baldwin wrote: > My 'dilemma' is that this functionality is packaged and the database it is > bundled into could be running on a pre-12 version or 12+. Is there any way > I can rewrite my view to achieve the same outcome (i.e. only creating 0 or > 1 advisory

Re: Problem with trigger function

2021-02-11 Thread David G. Johnston
On Thursday, February 11, 2021, Steve Baldwin wrote: > Try ... EXECUTE PROCEDURE customer_num_informix() > FUNCTION, not PROCEDURE David J.

Re: Problem with trigger function

2021-02-11 Thread David G. Johnston
On Thursday, February 11, 2021, Steve Baldwin wrote: > David, from what I can see of the docs, for 9.6 it is PROCEDURE. It seems > FUNCTION didn't appear until 11. > Indeed. I didn’t pay attention to the version. David J.

Re: JSONB_AGG: aggregate function calls cannot be nested

2021-02-22 Thread David G. Johnston
On Monday, February 22, 2021, Alexander Farber wrote: > > > but how to get a JSON map of lists here? I am trying: > > { >"day": [ "2021-02-08", "2021-02-09", ... ], >"completed": [ 475, 770, ...], >"expired": [ 155, 263 , ...] > } > If you want the days aggregated then don’t “group

Re: Migrate database to different versions

2021-02-22 Thread David G. Johnston
On Monday, February 22, 2021, Lorenzzo Egydio Mollinar da Cruz < loren...@iftm.edu.br> wrote: > I need to migrate a database from postgresql 9 to postgresql 12, as I will > update the version of my MOODLE and the current version does not support > postgres 9, is there any procedure for me to

Re: Simple IN vs IN values performace

2021-02-22 Thread David G. Johnston
On Monday, February 22, 2021, Oleksandr Voytsekhovskyy wrote: > What is the right way to pass long INT values list to IN filter > Don’t. Pass in a delimited string, then parse that string into an array and use “= any(array)”. This has the primary benefit of making the input a single

Re: Selecting table row with latest date [RESOLVED]

2021-08-19 Thread David G. Johnston
On Thu, Aug 19, 2021 at 12:34 PM Rich Shepard wrote: > group by p.person_nbr, c.contact_date > I thought you said (p.person_nbr, c.contact_date) is already unique? David J.

Re: Selecting table row with latest date [RESOLVED]

2021-08-19 Thread David G. Johnston
On Thu, Aug 19, 2021 at 2:52 PM Rich Shepard wrote: > On Thu, 19 Aug 2021, David G. Johnston wrote: > > > I thought you said (p.person_nbr, c.contact_date) is already unique? > > Yes, that's the PK for the contacts table. I'm still unsure what needs to > be > explic

Re: Serious Assistance with PostgreSQL True Infinite Arbitrary Precision Maths.

2021-08-18 Thread David G. Johnston
On Wed, Aug 18, 2021 at 7:34 PM A Z wrote: > The library that I have been using so far is ttmath, in GNU C++. That > library > is High Precision, in the end, and does seem to be high precision enough, > accurate enough and fast enough for my programs. > I'm guessing from the silence, and my

Re: transpose time-series columnar data

2021-08-17 Thread David G. Johnston
On Tue, Aug 17, 2021 at 11:29 AM Edu Gargiulo wrote: > > I need to transpose and return one row for a single timestamp and one > column for every name (fixed number of names), something like this > > https://www.postgresql.org/docs/current/tablefunc.html or select ..., max(value) filter (where

Re: Make bloom extension trusted, but can not drop with normal user

2021-08-24 Thread David G. Johnston
On Tue, Aug 24, 2021 at 8:17 AM Adrian Klaver wrote: > > To me the issue is that the extension was modified to trusted by an end > user not the extension author. I gotta believe there is more to the > trusted then a flag in the control file. It would not be surprising to > me that an ad hoc

Re: Make bloom extension trusted, but can not drop with normal user

2021-08-24 Thread David G. Johnston
On Fri, Aug 20, 2021 at 6:26 AM Tom Lane wrote: > "Li EF Zhang" writes: > > Since pg13 support trusted extension, so I changed control file of bloom > and make it trusted. > > The fact that you can edit the file that way doesn't make it a supported > case. > > Why does that matter here though?

Re: Make bloom extension trusted, but can not drop with normal user

2021-08-24 Thread David G. Johnston
On Sat, Aug 21, 2021 at 1:09 PM Mladen Gogala wrote: > Why do you think that the normal user should be allowed to drop > extensions? The documentation. https://www.postgresql.org/docs/current/sql-createextension.html "This configuration gives the calling user the right to drop the extension,

Re: use fopen unknown resource

2021-08-28 Thread David G. Johnston
On Fri, Aug 27, 2021 at 2:59 PM ourdiaspora wrote: > Please what is the syntax to assign an unknown file name to the 'fopen' > function? > > There isn't one as it would make no sense - how is it supposed to open a file if there is no filename provided to open? You have to set things up yourself

Re: PostgreSQL 12 - ERROR: invalid attribute number 2 for ad_user_pkey - Urgent

2021-09-01 Thread David G. Johnston
On Wed, Sep 1, 2021 at 8:08 AM FOUTE K. Jaurès wrote: > Any idea how to solve this issue is really appreciated > Have you restarted the server? In pg_attribute for one of the problematic tables are all of the columns present that should be (i.e., is this a catalog contents error or, say, a

Re: PostgreSQL 12 - ERROR: invalid attribute number 2 for ad_user_pkey - Urgent

2021-09-01 Thread David G. Johnston
On Wed, Sep 1, 2021 at 8:29 AM FOUTE K. Jaurès wrote: > I already restart the server (x3) > > Ok. During server startup (or shutdown for that matter) are there any warnings or errors in the log file? Is there anything in the server logs from around the time this started to occur? You haven't

Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int

2021-08-24 Thread David G. Johnston
On Tue, Aug 24, 2021 at 9:20 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Tue, Aug 24, 2021 at 8:51 PM Li EF Zhang wrote: > >> Thanks for your answer. My doubt is that since an ordinary user creates > >> the extension, shouldn't be this

Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int

2021-08-24 Thread David G. Johnston
On Tue, Aug 24, 2021 at 8:51 PM Li EF Zhang wrote: > Thanks for your answer. My doubt is that since an ordinary user creates > the extension, shouldn't be this user the owner of the objects created > within the extension? > While that is a possible implementation choice, that isn't what was

Re: lower() and unaccent() not leakproof

2021-08-25 Thread David G. Johnston
On Wednesday, August 25, 2021, Christophe Pettus wrote: > > lower() and unaccent() (and most string functions) are not marked as > leakproof. Is this due to possible locale / character encoding errors they > might encounter? > > I think you are partially correct. Its due to the fact that error

Re: Insert statement doesn't complete

2021-08-28 Thread David G. Johnston
On Saturday, August 28, 2021, Trang Le wrote: > > after running script > > How? > > I check this script in pg_lock, everything ok, job > done, data is inserted. > > You can tell this from pg_lock? > > > However, the session > > Where is this session? David J.

Re: database design with temporary tables

2021-08-29 Thread David G. Johnston
On Sunday, August 29, 2021, Ray O'Donnell wrote: > >>> >> Is there an alternative scenario, such as the user is able to create >> a new table with saves the session data for a maximum time (such as >> 24 hours), even up to a certain time if the web browser crashes for >> example? > > In general

Re: database design with temporary tables

2021-08-29 Thread David G. Johnston
On Sunday, August 29, 2021, ourdiaspora wrote: > > > Yes, wanted to know relevant parts because often the first problem is to > know which part of the (extensive) documentation to read... > > Suggest you just start developing. When you get stuck the nature of the block should inform where to go

<    3   4   5   6   7   8   9   10   11   12   >