Re: Key encryption and relational integrity

2019-03-29 Thread Karsten Hilbert
What Andrea Moreno's client seems to think is required by GDPR is clearly bogus -- it would render illegal any and all DICOM images existing today, because they contain programmatically easily processable personally identifying data right inside the clinical data. Karsten Hilbert -- GPG

Re: does postgresql backup require additional space on disk

2019-05-13 Thread Karsten Hilbert
On Mon, May 13, 2019 at 07:33:58PM +, Julie Nishimura wrote: > We have added new disk volume and about to introduce new > tablespace using this additional disk space. After that, I am > going to alter all user dbs (and template db as well) by > runnig the following command: > > CREATE TABLESPA

CREATE DATABASE ... TEMPLATE ... vs checksums

2019-06-03 Thread Karsten Hilbert
The application I am working on is doing database upgrades by cloning the previous release into a new database by means of CREATE DATABASE new_one TEMPLATE old_one ...; (health care, extremely conservative, contingency: can switch back to still existing old database with old client at any

verify checksums / CREATE DATABASE

2019-06-05 Thread Karsten Hilbert
Dear all, I cannot find documentation on whether CREATE DATABASE ... TEMPLATE template_db; will verify checksums (if enabled) on template_db during reading. I would assume it does not, because very likely the copy process happens at the file level. Is that correct ? Many thanks, Karste

Re: Requirement PA-DSS 1.1.4

2019-06-06 Thread Karsten Hilbert
On Thu, Jun 06, 2019 at 11:41:40AM +0700, Benjamin Scherrey wrote: > You should never store such information > in a database product unless you plan of decommissioning ALL of the media > that stores the information once you're supposed to lose custody. Use a tablespace on a dedicated disk. Move

pg_dump include/exclude data, was: verify checksums / CREATE DATABASE

2019-06-06 Thread Karsten Hilbert
Now that it is established that CREATE DATABASE does not verify checksums on the template I have a followup question. The current canonical solution (?) for verifying checksums in an existing database is, to may understanding, to pg_dump it (to /dev/null, perhaps): pg_dump --username=...

Re: pg_dump include/exclude data, was: verify checksums / CREATE DATABASE

2019-06-11 Thread Karsten Hilbert
Dear Adrian, On Fri, Jun 07, 2019 at 08:02:32AM -0700, Adrian Klaver wrote: > On 6/6/19 6:50 AM, Karsten Hilbert wrote: > > The current canonical solution (?) for verifying checksums in > > an existing database is, to may understanding, to pg_dump it > > (

Re: pg_dump include/exclude data, was: verify checksums / CREATE DATABASE

2019-06-11 Thread Karsten Hilbert
Dear Tom, On Fri, Jun 07, 2019 at 11:41:36AM -0400, Tom Lane wrote: > On 6/6/19 6:50 AM, Karsten Hilbert wrote: > >> The current canonical solution (?) for verifying checksums in > >> an existing database is, to may understanding, to pg_dump it > >> (to /dev/nul

Aw: Re: pg_dump include/exclude data, was: verify checksums / CREATE DATABASE

2019-06-11 Thread Karsten Hilbert
> > The problem I hope to protect against with this approach: the > > CREATE DATABASE might untaint corrupted data from a bad disk > > block into a good disk block virtue of doing a file level > > copy. > > > > I hope my reasoning isn't going astray. > > As I understand it checksums are done on the

Re: Row data is reflected in DETAIL message when constraints fail on insert/update

2019-06-20 Thread Karsten Hilbert
On Thu, Jun 20, 2019 at 01:26:23PM +0200, Shay Rojansky wrote: > In other words, this isn't about verbosity, but about sensitive data. It > seems like a specific knob for sensitive information may be required, which > would be off by default and would potentially affect other fields as well > (if

Re: Row data is reflected in DETAIL message when constraints fail on insert/update

2019-06-20 Thread Karsten Hilbert
On Thu, Jun 20, 2019 at 05:22:20PM +0200, Shay Rojansky wrote: > It seems generally agreed that all data from the database should be > considered potentially sensitive and should therefore not be leaked in log > messages - unless an explicit, informed opt-in is done. It is extremely > easy to imag

Re: Row data is reflected in DETAIL message when constraints fail on insert/update

2019-06-21 Thread Karsten Hilbert
On Thu, Jun 20, 2019 at 12:16:53PM -0400, Tom Lane wrote: > Admittedly, in your example there's a difference between what "the app" > should know and what "the user using the app" should know. But I'm not > really seeing how Postgres could usefully model that situation. We have > no idea about t

Re: Row data is reflected in DETAIL message when constraints fail on insert/update

2019-06-22 Thread Karsten Hilbert
On Sat, Jun 22, 2019 at 06:40:10PM +0200, Peter J. Holzer wrote: > > How is it useful in a normally configured database to return row data in > > error messages? > > This is extremely useful. It tells you what data didn't match your > program's expectations. Otherwise you just get a vague "unique

Re: Sequences part 2

2019-07-02 Thread Karsten Hilbert
On Tue, Jul 02, 2019 at 11:20:42AM +, Karl Martin Skoldebrand wrote: > Yes, I'm fairly aware of this. However the application the database table > belongs to seems to rely on a specific order in the database. I.e. if I just > add value to the table they end up, possibly due to how the applic

Re: Too short field

2019-07-03 Thread Karsten Hilbert
On Wed, Jul 03, 2019 at 01:56:03PM +0200, Thomas Kellerer wrote: > Karl Martin Skoldebrand schrieb am 03.07.2019 um 13:30: > > Now, we have a bug in another application that prevents an automatic > > tool to enter certain users in the database. The organisational field > > is varchar(60) while the

Re: Too short field

2019-07-03 Thread Karsten Hilbert
On Wed, Jul 03, 2019 at 02:10:55PM +0200, Karsten Hilbert wrote: > > Karl Martin Skoldebrand schrieb am 03.07.2019 um 13:30: > > > Now, we have a bug in another application that prevents an automatic > > > tool to enter certain users in the database. The organisational f

Re: Reproducing incorrect order with order by in a subquery

2023-06-14 Thread Karsten Hilbert
Am Wed, Jun 14, 2023 at 01:03:06PM +0300 schrieb Ruslan Zakirov: > > This is a too complex query to build a test on. Tried simpler scenarios > > and failed. > > > > First of all I want to apologize. We work with multiple RDBMS systems. This > particular user is using mysql. ... > Anyway, yesterday

Re: Reproducing incorrect order with order by in a subquery

2023-06-15 Thread Karsten Hilbert
Am Thu, Jun 15, 2023 at 12:58:55AM +0300 schrieb Ruslan Zakirov: e.g. > https://mariadb.com/kb/en/why-is-order-by-in-a-from-subquery-ignored/ ... > My goal was to find a small dataset that demonstrates this ordering > mismatch. I attempted to think it through whether it is even *possible* to f

Aw: When will trusted PL/Python be supported?

2023-06-27 Thread Karsten Hilbert
> It seems to me that we have untrusted PL/Python for a long time, but > till now we still do not support trusted plpython. > > I'd like to know is supporting trusted PL/Python still in the > schedule? What is the reason for the current lack of support, and do > we have any relevant email discussio

question on auto_explain

2023-08-03 Thread Karsten Hilbert
Dear list, when debugging slow queries in a larger application (https://www.gnumed.de) I started to use auto_explain. The "normal" EXPLAIN warns https://www.postgresql.org/docs/current/sql-explain.html that ANALYZE on INSERT/UPDATE/DELETE will (of course, in hindsight) modify rows. Now, the

Aw: Re: question on auto_explain

2023-08-03 Thread Karsten Hilbert
> On Thu, Aug 3, 2023 at 9:29 AM Karsten Hilbert > mailto:karsten.hilb...@gmx.net]> wrote: >> >>   >>https://www.postgresql.org/docs/current/auto-explain.html[https://www.postgresql.org/docs/current/auto-explain.html] >> >> don't explicitel

Aw: Re: question on auto_explain

2023-08-03 Thread Karsten Hilbert
> > auto_explain automatically produces the explain output of a query that is > > running for reals.  The effect is identical to running explain analyze > > except your output > here is whatever the query would produce instead of > > the explain output, which instead goes into the log. > > Than

Re: question on auto_explain

2023-08-04 Thread Karsten Hilbert
Am Fri, Aug 04, 2023 at 01:33:19PM +0800 schrieb Julien Rouhaud: > > explicit hint towards write query side effects. > > The docs says that it automatically shows the execution plans, not that it's > itself doing an EXPLAIN. Yep, so maybe _that_ point warrants being pointed out: that auto_explain

Aw: Re: Fatal Error : Invalid Memory alloc request size 1236252631

2023-08-17 Thread Karsten Hilbert
  Even I used postgreSQL Large Objects by referring this link to store and retrieve large files (As bytea not working) https://www.postgresql.org/docs/current/largeobjects.html   But even now I am unable to fetch the data at once from large objects   select lo_get(oid);   Here I'm getting the same

Aw: Role for just read the data + avoid CREATE / ALTER / DROP

2023-08-25 Thread Karsten Hilbert
set default_transaction_read_only can help   Karsten     Gesendet: Freitag, 25. August 2023 um 14:38 Uhr Von: "Durumdara" An: "Postgres General" Betreff: Role for just read the data + avoid CREATE / ALTER / DROP Dear Members!   Normally we use the "db owner" role for the connection, but th

Aw: Time zone offset in to_char()

2024-01-11 Thread Karsten Hilbert
> In the above, I worked around the issue using a couple of user-defined > functions in PG. That should give a reasonable idea of the desired > functionality, but it's not an ideal solution to my problem: > 1). The first function has as a drawback that it changes the time zone for > the entire t

Aw: Time zone offset in to_char()

2024-01-11 Thread Karsten Hilbert
> > In the above, I worked around the issue using a couple of user-defined > > functions in PG. That should give a reasonable idea of the desired > > functionality, but it's not an ideal solution to my problem: > > 1). The first function has as a drawback that it changes the time zone for > > th

Re: How to redirect output from PostgreSQL pg_recvlogical to a file or a pipe?

2024-01-13 Thread Karsten Hilbert
Am Sat, Jan 13, 2024 at 05:53:14PM -0500 schrieb Ron Johnson: > *No,* that's a technology problem. What is the purpose of storing them > back in the database using psql? Or even the end goal to be achieved by that ? Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

Aw: Nested-Internal Functions

2024-01-16 Thread Karsten Hilbert
> I am currently using PostgreSQL 15 and I am trying to create a nested > function with the following structure: ...   > However, I get an error What *is* the error ? Karsten

Re: How should we design our tables and indexes

2024-02-11 Thread Karsten Hilbert
Am Sun, Feb 11, 2024 at 12:53:10PM +0530 schrieb veem v: > >> Pagination is already a hard problem, and does not even make sense when > > combined with "a continuous stream of inserts". What should the user see > > when they click on page 2? > > > > When the user clicks to the second page , it wil

Re: Safest pgupgrade jump distance

2024-02-12 Thread Karsten Hilbert
Am Mon, Feb 12, 2024 at 09:31:50AM -0500 schrieb Ron Johnson: > https://www.postgresql.org/docs/16/pgupgrade.html > "pg_upgrade supports upgrades from 9.2.X and later to the current major > release of PostgreSQL, including snapshot and beta releases." Just to be sure: it should be stressed that t

"reverse" (?) UPSERT -- how to ?

2024-02-17 Thread Karsten Hilbert
Dear list members, maybe I am overlooking something. PostgreSQL offers UPSERT functionality by way of INSERT INTO ... ON CONFLICT ... DO UPDATE ...; Consider this pseudo-code schema table master pk_master serial primary key value text ;

Re: "reverse" (?) UPSERT -- how to ?

2024-02-17 Thread Karsten Hilbert
Am Sat, Feb 17, 2024 at 08:55:57AM -0800 schrieb Adrian Klaver: > >Dear list members, > > > > >So, is this doable within one SQL statement (short of > >creating and running the abovementioned function in > >one go ;-) ? > > Don't know what version of Postgres you are on, assuming 15+ then maybe?:

Re: "reverse" (?) UPSERT -- how to ?

2024-02-17 Thread Karsten Hilbert
Am Sat, Feb 17, 2024 at 09:33:11AM -0700 schrieb Rob Sargent: > > So, is this doable within one SQL statement (short of > > creating and running the abovementioned function in > > one go ;-) ? > > > > Perhaps your pk_detail can be defined as generated always identity? Rob, I'm sure there's someth

Re: "reverse" (?) UPSERT -- how to ?

2024-02-17 Thread Karsten Hilbert
Am Sat, Feb 17, 2024 at 11:54:05AM -0500 schrieb Greg Sabino Mullane: > > There will be a view giving rows for > > each detail row enriched with master table data > > UNION ALL > > rows for each master row that does not have any detail row with > > detail table colu

Re: "reverse" (?) UPSERT -- how to ?

2024-02-17 Thread Karsten Hilbert
Am Sat, Feb 17, 2024 at 07:25:11PM +0100 schrieb Karsten Hilbert: > +1 except that I've got use for both parts of the UNION on > their own (they are both views themselves involving a bunch > of joins with yet other tables, 4 or 5 each or so ;-) Just for kicks, attached find

Re: pl/pgsql outside the DB, (i.e. on the terminal) possible ?

2024-03-07 Thread Karsten Hilbert
Am Thu, Mar 07, 2024 at 04:56:18PM +0200 schrieb Achilleas Mantzios - cloud: > Python IMHO is too advanced, too rich, Python _is_ powerful but it needn't be difficult. > weird indentation rules A matter of taste IMO. > no simple for loop Really ? Python 3.11.2 (main, Mar 13 2023, 12:

Re: pl/pgsql outside the DB, (i.e. on the terminal) possible ?

2024-03-07 Thread Karsten Hilbert
Am Thu, Mar 07, 2024 at 08:04:21PM +0200 schrieb Achilleas Mantzios: > > Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux > > Type "help", "copyright", "credits" or "license" for more information. > > >>> for idx in [0,1,2,3]: print(idx) > > Dude this is like saying th

DROP COLLATION vs pg_collation question

2024-06-11 Thread Karsten Hilbert
Dear list members, maybe a naive question but I was unable to find an answer in the fine manual (sv_SE being an example) Does running DROP COLLATION IF EXISTS pg_catalog."sv_SE" also remove the corresponding row from pg_collation (assuming nothing depends on collation sv_SE) ? Experime

Re: DROP COLLATION vs pg_collation question

2024-06-12 Thread Karsten Hilbert
> > DROP COLLATION IF EXISTS pg_catalog."" > > Yes, that will delete a row from "pg_collation". Many thanks. > Note that with DROP COLLATION you can only remove collations > that belong to the encoding of your current database. A-ha ! Can that bit be found anywhere in the docs ? IOW, t

Re: DROP COLLATION vs pg_collation question

2024-06-14 Thread Karsten Hilbert
Am Thu, Jun 13, 2024 at 09:49:46AM +0200 schrieb Laurenz Albe: > > > Note that with DROP COLLATION you can only remove collations > > > that belong to the encoding of your current database. > > src/backend/catalog/namespace.c: > > /* >* get_collation_oid - find a collation by possibly qualif

Re: DROP COLLATION vs pg_collation question

2024-06-16 Thread Karsten Hilbert
Am Sun, Jun 16, 2024 at 06:53:31AM +0200 schrieb Laurenz Albe: > On Fri, 2024-06-14 at 22:08 +0200, Karsten Hilbert wrote: > > Are collations per-database or per-cluster objects ? > > Each database has its own "pg_collation" catalog table. > > So they are local

Re: DROP COLLATION vs pg_collation question

2024-06-18 Thread Karsten Hilbert
Am Sun, Jun 16, 2024 at 04:38:49PM -0400 schrieb Tom Lane: > It's really kind of moot, since you can't change the encoding > of an existing database. So any pg_collation entries that are > for an incompatible encoding cannot be used for anything in that > database, and they might as well not be t

Re: DROP COLLATION vs pg_collation question

2024-06-18 Thread Karsten Hilbert
Am Tue, Jun 18, 2024 at 03:02:56PM +0200 schrieb Karsten Hilbert: > I see, and since any database can be used as a template for > more databases, which can be create with an encoding > different from the template, Proving myself wrong: root@hermes:~/tmp# sudo -u postgres psql -e -f /t

Re: Transaction issue

2024-06-20 Thread Karsten Hilbert
Am Wed, Jun 19, 2024 at 02:32:07PM -0700 schrieb Rich Shepard: > Yes, I see how this works if the transaction is committed. But before I > commit the transaction I run a select statement to ensure the rows added are > correct. Can I rollback a commited transaction? I've assumed not, so I won't > c

Re: Reg: Size difference

2024-09-13 Thread Karsten Hilbert
Am Fri, Sep 13, 2024 at 05:39:22PM +0530 schrieb Vinay Oli: > I'm currently facing a strange issue with PostgreSQL 15.0. I have a > primary-standby setup that is in sync, with a replication slot in place. > There are 18 databases, and one of the databases on the primary side is 104 > GB, while the

Re: client waits for end of update operation and server proc is idle

2021-04-23 Thread Karsten Hilbert
Am Fri, Apr 23, 2021 at 10:48:24AM +0200 schrieb Laurenz Albe: > > The serverlog has around this time (sorry for German): > > > > 2021-04-23 05:55:23.591 CEST [2317] LOG: unvollständige Message vom Client > > 2021-04-23 05:55:23.593 CEST [2317] FEHLER: Speicher aufgebraucht > > 2021-04-23 05:55:

Re: client waits for end of update operation and server proc is idle

2021-04-25 Thread Karsten Hilbert
Am Sun, Apr 25, 2021 at 01:21:25PM -0400 schrieb Tom Lane: > > 10:57:16.051326 IP 127.0.0.1.52288 > 127.0.0.1.5432: Flags [P.], seq > > 14280:14407, ack 120304, win 512, options [nop,nop,TS val 3424445708 ecr > > 3424445708], length 127 > > 0x: 4500 00b3 b84e 4000 4006 83f4 7f00 000

Aw: Ideas for building a system that parses medical research publications/articles

2021-06-05 Thread Karsten Hilbert
> I am imagining a system that can parse papers from various sources > (web/files/etc) and in various formats (text, pdf, etc) and can store > metadata for this paper ,some kind of global ID if applicable, authors, > areas of research, whether the paper is "new", "highlighted", > "historical", type

Aw: Re: Database issues when adding GUI

2021-06-07 Thread Karsten Hilbert
> The problem source is postgres telling me it cannot connect to the database via TCP/IP > but I can do so directly using psql: via UNIX domain sockets. That makes a difference. See pg_hba.conf. Karsten

pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-20 Thread Karsten Hilbert
Dear all, I am testing the pg_restore of a database with default_transaction_read_only=on. The following issue ensues sudo -u postgres pg_restore --verbose --create --dbname=template1 --exit-on-error -p 5432 /tmp/gnumed/gm-restore_2021-06-20_18-31-07/backup-gnumed_v22-GNUmed_Team-herme

Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-20 Thread Karsten Hilbert
Dear Jain, > Did I simulate your concern correctly ? Nearly so, to my understanding. What you did (and thanks for the followup) was ... > postgres@db:~/playground/logical_replication$ rm -rf example > postgres@db:~/playground/logical_replication$ initdb -D example 2>/dev/null > >/dev/null > post

Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-20 Thread Karsten Hilbert
Am Sun, Jun 20, 2021 at 01:47:47PM -0400 schrieb Tom Lane: > Hence, the only way to make this scenario work would be for the > restore script to explicitly override default_transaction_read_only. [...] > Also, doing so would result in ignoring default_transaction_read_only > no matter what the sou

Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-20 Thread Karsten Hilbert
Am Sun, Jun 20, 2021 at 09:34:45PM +0200 schrieb Karsten Hilbert: > Any chance pg_dump (and/or pg_restore) might gain an option > --ignore-read-only ? That way, PostgreSQL need not decide > for users. Or, options --pre-dump-sql and -post-dump-sql ? Users could then run setup/teardow

Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-20 Thread Karsten Hilbert
Am Sun, Jun 20, 2021 at 01:14:06PM -0700 schrieb Adrian Klaver: > >Any chance pg_dump (and/or pg_restore) might gain an option > >--ignore-read-only ? That way, PostgreSQL need not decide > >for users. > > How about: > > 1) pg_dump -Fc -d read_only_db -U postgres -f read_only.out > > 2) In new c

Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-25 Thread Karsten Hilbert
> >And this is the restore: > > > sudo -u postgres psql -d postgres -f create_database.sql > > sudo -u postgres pg_restore --verbose --create --dbname=template1 > > --exit-on-error -p ${GM_PORT} ${BACKUP}.dir/ > Remove --create and change dbname to the database name from > creat

Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

2021-06-25 Thread Karsten Hilbert
Am Fri, Jun 25, 2021 at 11:39:46AM +0200 schrieb Karsten Hilbert: > I would be happy to hope that pg_dump might ... > gain a --do-not-alter-database-to-read-only or even a --(pre|post)-dump-sql=(pre|post).sql allowing for (here) temporarily altering a role to default_transaction_read_only=

Re: PostgreSQL reference coffee mug

2021-08-07 Thread Karsten Hilbert
Am Fri, Aug 06, 2021 at 08:09:03PM +0200 schrieb Matthias Apitz: > The prototype is ready. Nice. Now the elephant needs to fade into the background. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

Re: Issue with a query while running on a remote host

2021-08-27 Thread Karsten Hilbert
Deep packet inspection naively scanning for potential fragments of bash scripts being transferred ? Karsten Am Fri, Aug 27, 2021 at 12:32:09PM +0530 schrieb Ninad Shah: > Date: Fri, 27 Aug 2021 12:32:09 +0530 > From: Ninad Shah > To: pgsql-general > Subject: Issue with a query while running on

Aw: Re: Timestamp with vs without time zone.

2021-09-21 Thread Karsten Hilbert
> It seems like it would be so much more useful if the timestamp with > time zone type actually stored the time zone in the record. Which one ? Karsten

Aw: Re: Timestamp with vs without time zone.

2021-09-21 Thread Karsten Hilbert
> > It seems like it would be so much more useful if the timestamp with > > time zone type actually stored the time zone in the record. > > This has been requested before, and it would be closer to the intention > of the SQL standard, but I guess it won't happen. > > For one, it would change on-dis

Aw: Re: Re: Timestamp with vs without time zone.

2021-09-21 Thread Karsten Hilbert
> > > It seems like it would be so much more useful if the timestamp with > > > time zone type actually stored the time zone in the record. > > > > Which one ? > > > One specified by the user. Many date formats carry either an offset > or the time zone information. What would that TZ mean, exactl

Aw: Re: Re: Timestamp with vs without time zone.

2021-09-21 Thread Karsten Hilbert
> It's just that the phrase > "timestamp with time zone" would seem to indicate the time zone is > stored somewhere in there. Now, I can fully agree with _that_ :-) Karsten

Re: Timestamp with vs without time zone.

2021-09-22 Thread Karsten Hilbert
Am Wed, Sep 22, 2021 at 08:11:50PM +1200 schrieb Tim Uckun: > A korean user will fetch you single page app as static HTML from S3 > with cloudfront. It will hit your japanese API server, which will > fetch the data from your japanese read only replica with the master > being in Australia. > > The

Re: PostgreSQL - Ordering Table based of Foreign Key

2021-10-03 Thread Karsten Hilbert
Am Sun, Oct 03, 2021 at 08:48:13AM +0100 schrieb FOUTE K. Jaurès: > I want to order tables based on the foreign key so that I can delete tables > one by one without facing "ERROR: update or delete on table "table" > violates foreign key constraint. DETAIL: Key is still referenced from table" drop

Re: pg_dump save command in output

2021-10-03 Thread Karsten Hilbert
Am Sun, Oct 03, 2021 at 06:15:54PM +0100 schrieb Joao Miguel Ferreira: > I just wanted to save the command inside the SQL file to be able to > "remember" it later. ideally I would open the file on some text editor and > see the original pg_dump command on the few first lines, as a comment > > -- o

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Karsten Hilbert
Am Sun, Oct 03, 2021 at 07:16:32PM +0100 schrieb Shaozhong SHI: > That is interesting. Can errors be captured and saved as data with > scripting? Depends on what the script does. If the script runs (or is written in) Python the canonical PG driver (psycopg2/3) will give you such data. Karsten

Re: PostgreSQL CHECK Constraint

2021-10-03 Thread Karsten Hilbert
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- Karsten Sure, they are just a search engine's use away. > Are there any examples on the web these days? > That sounds brilliant. :Am Sun, Oct 03, 2021 at 07:44:41PM +0100 schrieb Shaozhong SHI

Aw: Re: Fault with initcap

2021-10-12 Thread Karsten Hilbert
Hi David, >Expected are as follows: >Notemachine >Sainsbury's bank. Now, step two: generalize that exemplary definition. Karsten

Aw: Re: Re: Fault with initcap

2021-10-12 Thread Karsten Hilbert
> Only the first letter of each word to be capitalised/uppercased. The next step is to not top-post. Then to keep the list involved if you wish further help. Then, if you are intent on using regular expressions, look at the PostgreSQL docs for regexp_replace. Karsten  

Re: Fault with initcap

2021-10-12 Thread Karsten Hilbert
Am Tue, Oct 12, 2021 at 09:50:16PM +0100 schrieb Shaozhong SHI: > There must be a way to do the following. > > [...] Only the first letter of each word should be capitalised. Indeed, there is. It is called "human brain in cultural context". "AI" is close nowadays, but, hopefully, not quite there

Re: check scripts after database code change

2021-11-18 Thread Karsten Hilbert
Am Thu, Nov 18, 2021 at 05:45:37PM +0300 schrieb Dennis: > Are there any scripts that we can check after the changes we made in the > database code? > In summary, are there any automatic post-development scripts before they > come to the beta stage? What do you want those script to do ? Karsten

Re: How to allow null as an option when using regexp_matches?

2021-12-08 Thread Karsten Hilbert
Am Wed, Dec 08, 2021 at 12:07:13PM + schrieb Shaozhong SHI: > We can do this: > select count(*) from regexp_matches('Great London', 'Great > London|Information Centre|Department for Transport', 'g'); > > Is it possible to allow null as an option? something like this > select count(*) from reg

Re: a very naive question about table names in Postgres

2021-12-31 Thread Karsten Hilbert
Am Fri, Dec 31, 2021 at 08:27:59PM + schrieb Martin Mueller: > I much prefer Postgres to Mysql for a variety of reasons, > but mostly for its elegant string functions. But in Mysql it > seems to be much easier to keep track of tables. May I ask for the context of "keep track of tables" ? Ka

Re: Proposed German Translation of Code of Conduct Policy

2022-01-24 Thread Karsten Hilbert
t, mit der Ausnahme, dass die > Person, die in die Beschwerde involviert ist, in ihrer > Funktion im Komitee oder dem Core-Team vom Verfahren > ausgeschlossen wird. What happens if all members of the committee are impeached at once ? > Die Komitee kann feststellen, dass ein Verstoß gegen

Aw: Counting the number of repeated phrases in a column

2022-01-25 Thread Karsten Hilbert
> There is a short of a function in the standard Postgres to do the following: >   > it is easy to count the number of occurrence of words, but it is rather > difficult to count the number of occurrence of phrases. >   > For instance: >   > A cell of value:  'Hello World' means 1 occurrence a phra

Aw: Re: Counting the number of repeated phrases in a column

2022-01-25 Thread Karsten Hilbert
> How about split up the value into individual words and keep their orders? > add words up to form individual phrase and ensure that each phrase only > consists unique/distinct words > count repeated phrases afterward >   > How about this? Sure, if that serves your purpose ? So far, we (I?) can'

Re: Counting the number of repeated phrases in a column

2022-01-26 Thread Karsten Hilbert
Am Wed, Jan 26, 2022 at 08:35:06PM + schrieb Shaozhong SHI: > Whatever. Can we try to build a regex for 'The City of London London > Great London UK ' ? Would you be so kind as do be more specific about that "we" ? Best, Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

Re: Counting the number of repeated phrases in a column

2022-02-01 Thread Karsten Hilbert
Am Tue, Feb 01, 2022 at 11:29:50PM + schrieb Shaozhong SHI: > How about knock unique words into discrete joint up strings? Then check > whether there is any repeated words? Does it work when you try ? Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

Re: Can we go beyond the standard to make Postgres radically better?

2022-02-10 Thread Karsten Hilbert
Am Wed, Feb 09, 2022 at 09:14:39PM -0800 schrieb Guyren Howe: > There are huge developer benefits available to focusing > more on making a great relational programming environment, > well outside the SQL standard. There's a seemingly small but conceptually rather significant difference between go

Re: Proposed German Translation of Code of Conduct Policy

2022-02-10 Thread Karsten Hilbert
Am Thu, Feb 10, 2022 at 03:24:54PM +0500 schrieb Umair Shahid: > > What happens if all members of the committee are impeached at once ? > > > > That is one reason to strive for diversity in the CoC Committee - the > chances of this happening are reduced to near-zero. It may be near-zero for impea

Aw: Operator % and its meaning and use

2022-02-15 Thread Karsten Hilbert
Dear David, > Can anyone remind me of the meaning and use of operator %.   I can gladly report that I remember having seen relevant documentation on that operator while Reading up in The Fine Manual on json_to_row following the hint Ion kindly provided. It was amazing ! Reading up on that helped

Re: Is there a way to automatically scan a table and determine the format of data

2022-02-16 Thread Karsten Hilbert
Am Wed, Feb 16, 2022 at 01:27:56AM + schrieb Shaozhong SHI: > Is there a way to automatically scan a table and report the format of data > for each column? pg_class But you may want to rethink the approach given that you use Python. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80

Aw: Additional accessors via the Extension API ?

2022-02-20 Thread Karsten Hilbert
> Suppose I have defined an additional type in a PG extension. > > Is it possible to add custom accessors to that type -much like jsonb does- > but use an API/hook without touching the core PG grammar & parser? > > Hypothetical Examples: > > Assuming I have a TextFile type I’d like to implem

Re: Feature idea: Dynamic Data Making

2017-12-05 Thread Karsten Hilbert
On Tue, Dec 05, 2017 at 09:59:22PM +0100, Riccardo Bassani wrote: > https://docs.microsoft.com/en-us/sql/relational-databases/security/dynamic-data-masking There's already at least 4 mechanismus that come to mind which can do things like that: on SELECT RULEs VIEWs colu

Re: a back up question

2017-12-06 Thread Karsten Hilbert
On Tue, Dec 05, 2017 at 09:52:28PM +, Martin Mueller wrote: > Are there rules for thumb for deciding when you can dump a > whole database and when you’d be better off dumping groups of > tables? It seems to me we'd have to define the objective of "dumping" first ? Regards, Karsten -- GPG ke

Re: a back up question

2017-12-06 Thread Karsten Hilbert
On Wed, Dec 06, 2017 at 12:52:53PM +, Martin Mueller wrote: >> Are there rules for thumb for deciding when you can dump a >> whole database and when you’d be better off dumping groups of >> tables? >> It seems to me we'd have to define the objective of "dumping" first ? > The objective is to

Re: How to know if a database has changed

2017-12-11 Thread Karsten Hilbert
On Mon, Dec 11, 2017 at 01:48:44PM -0300, marcelo wrote: > The installation I'm planning will manage several databases, but not all of > them will change every day. > In order to planning/scripting the pg_dump usage, I would need to know which > databases had some change activity at the end of som

Re: pg_dump and logging

2017-12-11 Thread Karsten Hilbert
On Mon, Dec 11, 2017 at 01:51:59PM -0300, marcelo wrote: > When pg_dump runs on a database, is it warranted that the log is fully > impacted, or at least, taken into account for the dumping? As per the second sentence in the Description section of the Fine Manual. Karsten -- GPG key ID E4071346

Re: How to know if a database has changed

2017-12-12 Thread Karsten Hilbert
On Tue, Dec 12, 2017 at 07:40:46AM -0500, Adam Tauno Williams wrote: > > The next day, that backup will be copied to the cloud. > > What does this mean?  If it is rsync of a local dump to a remote use > the directory dump format - disable compression - then each table which > didn't change will '

Re: Adding an extra boolean column to "information_schema.columns" or "pg_attribute"

2017-12-30 Thread Karsten Hilbert
On Sat, Dec 30, 2017 at 08:17:34PM +0100, GPT wrote: > I would like to add an extra boolean attribute to table columns, > something like NULL. Unfortunately Pg does not support such a feature: > > ADD ATTRIBUTE TYPE TO COLUMN > ; ... > I have already been suggested to use VIEW or dynamic SQL bu

Re: Use of Port 5433 with Postgresql 9.6

2018-01-01 Thread Karsten Hilbert
On Mon, Jan 01, 2018 at 05:42:28PM +, Graeme wrote: > If the default port for v9.6 is 5433, It is not. > why does the utility pg_isready still > default to searching for 5432? Which is why. Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F

Re: Equivalent shell script of create user and schema in specific postgres db

2018-01-31 Thread Karsten Hilbert
On Wed, Jan 31, 2018 at 10:27:53PM +0530, Abhra Kar wrote: > Create a user and schema of same name with in ‘abc’ db through linux shell – > > > > Psql steps--- > > > > 1> [/home]# su postgres > > 2> bash-4.1$ psql > > 3> postgres=# \c abc [ set database abc] > > 4> abc=# create user

Re: == PostgreSQL Weekly News - January 28 2018 ==

2018-02-25 Thread Karsten Hilbert
On Mon, Jan 29, 2018 at 03:57:48AM +0100, David Fetter wrote: > == PostgreSQL Weekly News - January 28 2018 == ... > == Applied Patches == ... > Tom Lane pushed: ... > - In pg_dump, force reconnection after issuing ALTER DATABASE SET command(s). > The folly of not doing this was exposed by the b

Re: pg_dumpall SET default_transaction_read_only = off (was Re: == PostgreSQL Weekly News - January 28 2018 ==)

2018-02-25 Thread Karsten Hilbert
-common/pg_upgradecluster.d/ # if you are using a postgresql-common package < v122 on Debian # and want to upgrade your cluster using . # # Note that pg_upgradecluster will run this as user . # # author: Karsten Hilbert # license: GPL v2 or later #===

Re: glibc updarte 2.31 to 2.38

2024-09-22 Thread Karsten Hilbert
Am Sun, Sep 22, 2024 at 02:59:34PM +0100 schrieb Shaheed Haque: > I've been working on Unix-like systems for decades and though I thought I > understood most of the issues to do with i18n/l10n, I've only just started > using Postgres and I don't understand is why these changes ONLY seem to > affec

Re: PostgreSQL Log Info

2024-11-22 Thread Karsten Hilbert
Am Fri, Nov 22, 2024 at 01:02:27PM +0530 schrieb Jethish Jethish: > If an select query is fired I need the query returned values needs to be > logged in my PostgreSQL log file. What do you expect your log file to be in size after, say, a day of activity ? Karsten -- GPG 40BE 5B0E C98E 1713 AFA6

Re: Lookup tables

2025-02-04 Thread Karsten Hilbert
Am Tue, Feb 04, 2025 at 06:30:53PM +0100 schrieb Michał Kłeczek: > > 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 transact

Re: Lookup tables

2025-02-04 Thread Karsten Hilbert
Am Tue, Feb 04, 2025 at 05:31:13PM +0100 schrieb Michał Kłeczek: > It is now completely unclear what it means to change the name of the > restaurant for already registered visits. > Is it still the same restaurant with a different name or a different > restaurant? > > Or let say someone swaps na

Re: Lookup tables

2025-02-04 Thread Karsten Hilbert
Am Tue, Feb 04, 2025 at 10:41:38PM +0100 schrieb Thiemo Kellner: > >> 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

<    1   2   3   >