Re: PG 10 logical replication version dependency?

2018-03-02 Thread Thomas Kellerer
Colin 't Hart schrieb am 02.03.2018 um 09:23: > Is there a version dependency when using logical replication? Do both > sides have to be running the same major version? Or is it a wire > protocol that will be backwards compatible in future releases? > > I sincerely hope it's the latter so that use

query_to_xml() returns invalid XML when query returns no rows

2018-03-12 Thread Thomas Kellerer
I am not sure if this qualifies as a bug: query_to_xml() returns an empty XML document when the query returns no rows, e.g: select query_to_xml('select 42 where false', false, true, ''); The problem with this is, that if the resulting XML is then fed into e.g. the xpath() function, that fu

Re: query_to_xml() returns invalid XML when query returns no rows

2018-03-13 Thread Thomas Kellerer
Peter Eisentraut schrieb am 12.03.2018 um 23:31: I am not sure if this qualifies as a bug: query_to_xml() returns an empty XML document when the query returns no rows, e.g: select query_to_xml('select 42 where false', false, true, ''); The problem with this is, that if the resulting XML i

Re: Hello all, I wanted to install any postgresql database for my development

2018-03-27 Thread Thomas Kellerer
sanjeev kumar schrieb am 28.03.2018 um 08:01: > Please suggest me any verion of PostgreSQL Database for my development > testing are improving my skills. If you are starting with Postgres the best choice is to use the current version which is 10. If you are using Linux, please follow the instru

Re: dealing with lock

2018-04-06 Thread Thomas Kellerer
Adrian Klaver schrieb am 07.04.2018 um 00:02: Is there a way to identify the list of statements that have to rewrite the table. https://www.postgresql.org/docs/10/static/sql-altertable.html Notes "Adding a column with a DEFAULT clause or changing the type of an existing column will require t

Re: Postgresql with JDK

2018-04-17 Thread Thomas Kellerer
vaibhav zaveri schrieb am 17.04.2018 um 08:47: > Hi,  > > Yes that is the link.  > But is JDK 1.8 supported by PostgreSQL??  > Postgres itself does not need or "support" Java. Only the JDBC driver needs that which is a client-side technology. And yes, the JDBC driver does support Java 8, which

Re: How to fetch data from tables in PostgreSQL

2018-04-18 Thread Thomas Kellerer
vaibhav zaveri schrieb am 18.04.2018 um 09:22: > How to fetch data from tables in PostgreSQL. That is done using the SELECT statement: https://www.postgresql.org/docs/current/static/sql-select.html For an introduction on how to write queries, you might want to have a look at the Postgres tutori

Re: postgres with graph model

2018-04-19 Thread Thomas Kellerer
Philipp Kraus schrieb am 19.04.2018 um 16:53: I’m using in a project Postgresql and PostGIS for a geospatial data model, but now I need also a graph in this structure, so my question is, is there any existing extension for Postgres to build a graph. I found ltree but this is for tree structures o

Re: How to find the hits on the databases and tables in Postgres

2018-05-04 Thread Thomas Kellerer
nikhil raj schrieb am 04.05.2018 um 18:45: But here is the issue is here we have 200+ databases and 5 servers so cannot manually runs this command all ways is there any 3rd party tool for that which would give me the hits on DB and tables in it so that it would be so help full for me. now curre

Re: How to reply to an existing bug?

2018-05-27 Thread Thomas Kellerer
Erwin Brandstetter schrieb am 28.05.2018 um 02:00: > I found an existing bug report and have something to add to it. > > What's the best way to reply to it? Just using a browser, with no newsreader > installed. > > This one: > https://www.postgresql.org/message-id/flat/20170925084522.1442.32786%

binaries for 11 beta compiled with --with-llvm?

2018-05-28 Thread Thomas Kellerer
Are there any plans to provide a binary download for the Postgres 11 beta with JITting enabled? Currently I can't find any packages under https://www.postgresql.org/download/ or http://www.enterprisedb.com/products-services-training/pgbindownload The only one I found was from BigSQL https://w

Re: binaries for 11 beta compiled with --with-llvm?

2018-05-28 Thread Thomas Kellerer
Andres Freund schrieb am 29.05.2018 um 08:28: >> But neither the Linux binaries nor the Windows binaries were compiled with >> the --with-llvm option >> (will JITting be possible with Windows at all?) > > Not in 11. I assumed that ;) Not a real problem. But what about Linux binaries with JITt

Postgres 11 beta - no JITing

2018-06-05 Thread Thomas Kellerer
Hello, I am trying to assess the benefits of the new JIT feature in Postgres 11. However I can't figure out how to enable it. I have a test server with "CentOS Linux release 7.5.1804" I installed the beta using: yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7.4-x

Re: Postgres 11 beta - no JITing

2018-06-05 Thread Thomas Kellerer
Andres Freund schrieb am 05.06.2018 um 14:34: >> I am trying to assess the benefits of the new JIT feature in Postgres 11. >> However I can't figure out how to enable it. >> >> I have a test server with "CentOS Linux release 7.5.1804" >> >> I installed the beta using: >> >> yum install >> http

Using distinct in an aggregate prevents parallel execution?

2018-06-06 Thread Thomas Kellerer
Consider this simplified example: select c.id, count(*) as total_orders, sum(p.price) as total_value from customer c join orders o ON c.id = o.customer_id join order_line ol ON o.id = ol.order_id join product p ON ol.product_id = p.id group by

Re: Using distinct in an aggregate prevents parallel execution?

2018-06-06 Thread Thomas Kellerer
Tom Lane schrieb am 06.06.2018 um 16:32: Thomas Kellerer writes: Is this a known limitation? Yes, unless somebody has done radical restructuring of the aggregation code while I wasn't looking. agg(DISTINCT ...) is currently implemented inside the Agg plan node, so it's an indivis

Re: Catching unique_violation exception on specific column/index

2018-06-11 Thread Thomas Kellerer
Alexey Dokuchaev schrieb am 11.06.2018 um 12:10: > I have a table with several UNIQUE and CHECK constraints. One of these > UNIQUE constraints actually *can* be violated -- not on the table level, > of course, but on the application level -- meaning, if the entry with > particular foo_key is alrea

Re: Catching unique_violation exception on specific column/index

2018-06-11 Thread Thomas Kellerer
Alexey Dokuchaev schrieb am 11.06.2018 um 12:58: >>> I have a table with several UNIQUE and CHECK constraints. One of these >>> UNIQUE constraints actually *can* be violated -- not on the table level, >>> of course, but on the application level -- meaning, if the entry with >>> particular foo_key

Re: First query on each connection is too slow

2018-06-13 Thread Thomas Kellerer
Vadim Nevorotin schrieb am 13.06.2018 um 11:55: > I have a very strange problem. I'm using PostgreSQL 9.6 with PostGIS > 2.3 (both from Debian Strecth repos) to store DB for OSM server (but > actually it doesn't matter). And I've noticed, that on each new > connection to DB first query is much slow

Re: PostgreSQL Volume Question

2018-06-20 Thread Thomas Kellerer
Data Ace schrieb am 15.06.2018 um 18:26: > Well I think my question is somewhat away from my intention cause of > my poor understanding and questioning :( > > Actually, I have 1TB data and have hardware spec enough to handle > this amount of data, but the problem is that it needs too many join > o

Plan output: actual execution time not considering loops?

2018-06-20 Thread Thomas Kellerer
Consider the following execution plan: Seq Scan on orders o1  (cost=0.00..18818840.86 rows=3500 width=16) (actual time=0.033..8625.104 rows=99906 loops=1)   Filter: (amount = (SubPlan 1))   Rows Removed by Filter: 600094   Buffers: shared hit=7719778   SubPlan 1     ->  Aggregate  (cost=26.87..26

Re: Plan output: actual execution time not considering loops?

2018-06-20 Thread Thomas Kellerer
Tom Lane schrieb am 20.06.2018 um 16:03: >> Consider the following execution plan: >> ... >>     ->  Aggregate  (cost=26.87..26.87 rows=1 width=32) (actual >> time=0.012..0.012 rows=1 loops=70) >>   ->  Bitmap Heap Scan on orders o2  (cost=3.45..26.85 rows=8 >> width=8) (actual time=0

Re: Schema/Data conversion opensource tools from MySQL to PostgreSQL

2018-06-25 Thread Thomas Kellerer
chiru r schrieb am 25.06.2018 um 18:47: Please suggest Schema/Data conversion opensource tools from MySQL to PostgreSQL. ora2pg also supports MySQL: https://github.com/darold/ora2pg

Re: CTE optimization fence

2018-06-26 Thread Thomas Kellerer
Tom Lane schrieb am 27.06.2018 um 05:48: >> I see there was some discussion last year about removing the CTE >> optimization fence (e.g. >> http://www.postgresql-archive.org/CTE-inlining-td5958992.html) but can't >> find anything more recent. Does anyone know if this is still under >> considera

Re: Windows 10 got stuck with PostgreSQL at starting up. Adding delay lets it avoid.

2018-06-28 Thread Thomas Kellerer
TAKATSUKA Haruka schrieb am 29.06.2018 um 08:03: > I got a trouble in PostgreSQL 9.3.x on Windows 10. > I would like to add new delay code as an official build option. > > Windows 10 sometime (approximately once in 300 tries) hung up > at OS starting up. The logs say it happened while the Postgre

When exactly is a TIMESTAMPTZ converted to the sessions time zone?

2018-07-03 Thread Thomas Kellerer
A recent discussion around timestamptz behaviour has lead me to question my own understanding on how a TIMESTAMPTZ is converted to the session's time zone. I assumed this conversion happens *on the server* before the value is sent to the client. A co-worker of mine claims that this is purely a

Re: How to set array element to null value

2018-07-09 Thread Thomas Kellerer
Brahmam Eswar schrieb am 09.07.2018 um 11:58: > I'm trying to reset array element to null. but 3rd line of below snippet is > giving the compilation error. > > > FOR indx_1 IN array_lower(X, 1)..array_upper(X, 1) LOOP > IF X[indx_1].REFERENCE_VALUE = 'ABC' THEN > X[indx_1].REFERENCE_VALUE:=''; >

Re: Create event triger

2018-07-10 Thread Thomas Kellerer
Łukasz Jarych schrieb am 09.07.2018 um 13:03: > i have small database and i am tracking changes using trigger: > > CREATE TRIGGER t BEFORE INSERT OR UPDATE OR DELETE ON t_trig > > FOR EACH ROW EXECUTE PROCEDURE change_trigger(); > > It is possible to create general trigger for all tables

Re: Disabling/Enabling index before bulk loading

2018-07-10 Thread Thomas Kellerer
Ravi Krishna schrieb am 10.07.2018 um 16:08: > > We recently did a test on COPY and found that on large tables (47 million > rows , 20GB of raw data) the > difference in COPY with 16 indexes and COPY without any index is 1:14. That > is, COPY is 14 times slower > when data is ingested with all

Re: Open Source tool to deploy/promote PostgreSQL DDL

2018-07-11 Thread Thomas Kellerer
Hustler DBA schrieb am 11.07.2018 um 00:13: > A client of mine is looking for an open source tool to > deploy and promote PostgreSQL DDL changes through database > environments as part of SDLC. What tools (open source) does the > community members use? I normally use scripts, but they want > someth

Re: Do we need yet another IDE (SQL development assistant) for PostgreSQL?

2018-07-16 Thread Thomas Kellerer
Tim Clarke schrieb am 16.07.2018 um 11:52: > +1 for not re-inventing the wheel - building on Netbeans or the Eclipse > project would save you heaps of time and effort and provide > cross-platform out of the box. I use Eclipse all the time. The NetBeans platform (and Eclipse as well) is based on Ja

Re: User documentation vs Official Docs

2018-07-16 Thread Thomas Kellerer
Joshua D. Drake schrieb am 16.07.2018 um 22:32: -general. Over the last year as I have visited many meetups and interacted with people at conferences etc... There are three prevailing issues that continue to come up in contributing to the community. This email is about one of them. Where is the

A bit confused about "pgsql_tmp" vs "temp tablespace"

2018-07-18 Thread Thomas Kellerer
In the chapter "Database File layout" the pgsql_tmp is explained as follows: Temporary files (for operations such as sorting more data than can fit in memory) are created within PGDATA/base/pgsql_tmp, or within a pgsql_tmp subdirectory of a tablespace directory However the documentat

Re: A bit confused about "pgsql_tmp" vs "temp tablespace"

2018-07-18 Thread Thomas Kellerer
Adrian Klaver schrieb am 18.07.2018 um 15:06: >> In the chapter "Database File layout" the pgsql_tmp is explained as follows: >> >>     Temporary files (for operations such as sorting more data than can fit >> in memory) >>     are created within PGDATA/base/pgsql_tmp, or within a pgsql_tmp >> su

Re: How to split an array into columns

2018-08-24 Thread Thomas Kellerer
a schrieb am 24.08.2018 um 11:01: > Say if I have an float8 array: > > id| data > --|--- > a | {1,2} > b | {2,4} > > If I could using query to make it looks like this: > > id| data[1] | data[2] > --|--|--- > a | 1 | 2 > b | 2 | 4 > > Since

Arrays, casting and "constrained" data types

2018-08-24 Thread Thomas Kellerer
I stumbled across the following: Consider the following (simplified) table: create table test ( val numeric(20,0), ref_val numeric(20,0) ); and the following very simple recursive CTE: with recursive tree as ( select val, array[val] as path from test uni

Re: PostgreSQL intenal scheduler?

2018-09-05 Thread Thomas Kellerer
Thiemo Kellner schrieb am 05.09.2018 um 17:06: > I am designing a framework for historisation implementation (SCD). > One feature I would like to provide is a table in that the actual > state of an entity is put and if this is complete, this history table > is "updated": > >  

Re: A Timeseries Case Study: InfluxDB VS PostgreSQL

2018-09-07 Thread Thomas Kellerer
Fabio Pardi schrieb am 07.09.2018 um 10:07: > Hi, > I recently published a blog article reporting a small research I made on > the usage of InfluxDB and PostgreSQL for time series, together with > Grafana on my specific use case. > > I think that some of you might find it interesting, maybe inspir

Re: COPY threads

2018-10-11 Thread Thomas Kellerer
Rob Sargent schrieb am 10.10.2018 um 00:45:> Can anyone here tell me whether or not the CopyManager facility in JDBC via org.postgresql:postgresql:42.1.4 is internally multithreaded? Running on CentOS 7 (all participants), java8, postgres 10.5 An alternative to creating your own multi-threaded

Re: Regarding varchar max length in postgres

2018-10-15 Thread Thomas Kellerer
Durgamahesh Manne schrieb am 15.10.2018 um 11:05: > On 10/5/18 8:18 AM, Durgamahesh Manne wrote: > > Hi > > > > please let me know the max length of varchar  & text in postgres > > https://www.postgresql.org/docs/10/static/datatype-character.html > >  H

Re: Regarding varchar max length in postgres

2018-10-15 Thread Thomas Kellerer
Durgamahesh Manne schrieb am 15.10.2018 um 11:18: > was there any specific reason that you have given max length for varchar is > limited to 10485760 value? > > why you have not given max length for varchar is unlimited like text datatype > ? > > |character varying(/|n|/)|, |varchar(/|n|/)|vari

How to extract information from pg_ddl_command type

2019-07-11 Thread Thomas Kellerer
The function pg_event_trigger_ddl_commands() returns several columns, one of them being "command" that is of the type "pg_ddl_command". The manual[1] describes this column as: > A complete representation of the command, in internal format. > This cannot be output directly, but it can be passe

Re: Download link for postgres 10.8 edb software

2019-07-11 Thread Thomas Kellerer
Nanda Kumar schrieb am 12.07.2019 um 04:55: > Currently we are using postgres database 9.7 version. We need to test > our application in 10.8 edb version. So can you please share the > download link for PostgreSQL 10.8 edb software. This is required for > testing purpose . > The current minor rel

Re: Tablespace column value null on select * from pg_tables

2019-07-15 Thread Thomas Kellerer
Alex Williams schrieb am 15.07.2019 um 20:35: But in my case, I have a database that's in a user-defined tablespace (data2) and all the tables/indexes there are also in data2 and I want to do a select into a table the results of all the tables / tablespaces they are in that database...when doing

Re: Too slow to create new schema and their tables, functions, triggers.

2019-07-26 Thread Thomas Kellerer
PegoraroF10 schrieb am 26.07.2019 um 00:16: > statement: create or replace function valoresdfe... 0 mins 1.135 secs > statement: create or replace function dadosorigem...0 mins 0.055 secs > statement: CREATE OR REPLACE FUNCTION SONU... 0 mins 0.013 secs > statement: create or repl

Re: Which version to upgrade upto

2019-07-31 Thread Thomas Kellerer
Vikas Sharma schrieb am 31.07.2019 um 17:57: The architects and developers have perception that the latest release always will have bugs and others might be using in production. They feel 11.2 will be better bet than 11.4. You should always use the latest minor version, so 11.4 is preferred ov

Re: Cursors for PGJDBC queries

2019-08-01 Thread Thomas Kellerer
Rashmi V Bharadwaj schrieb am 01.08.2019 um 09:10: > I am trying to set the fetch size for my ResultSet to avoid Out of > Memory exception. I have created the Statement with > ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY and > ResultSet.HOLD_CURSORS_OVER_COMMIT and I've also disabled aut

Re: How to check if a field exists in NEW in trigger

2019-08-04 Thread Thomas Kellerer
Igal @ Lucee.org schrieb am 05.08.2019 um 00:52: > I have the following statement in a trigger: > >     new.email = lower(new.email); > > When I try to update a record without setting the email column however, I get > an error: > > SQL Error [42703]: ERROR: record "new" has no field "email" >  

Re: How to check if a field exists in NEW in trigger

2019-08-05 Thread Thomas Kellerer
Pavel Stehule schrieb am 05.08.2019 um 08:19: >>> I have seen some hacks suggesting TRY/CATCH or converting to a JSON >>> and checking if the field exists, but I would think that there's a >>> better way to check if the field is in the NEW record, no? > >> I assume using to_jsonb(new) and then che

lead() with arrays - strange behaviour

2019-08-08 Thread Thomas Kellerer
Consider the following dummy table (this is a simplified example from a bigger query): create table sample_data (id int, id_list int[]); insert into sample_data (id, id_list) values (1, array[1,2,3]), (2, array[2,3,4]), (3, array[4,5,6]); The following statement

Re: lead() with arrays - strange behaviour

2019-08-08 Thread Thomas Kellerer
David Rowley schrieb am 08.08.2019 um 13:03: >> The following statement tries to find the overlapping values in id_list >> between the current row and the next row: >> >> select id, >>id_list, >>lead(id_list) over (order by id) as next_list, >>array(select u

Re: lead() with arrays - strange behaviour

2019-08-08 Thread Thomas Kellerer
Tom Lane schrieb am 08.08.2019 um 16:10: > David's point is that the two occurrences of lead() don't mean the > same thing. A window function is directly tied to the SELECT that > it is in the select-list of, and its notion of next and previous > rows is concerned with the set of rows that that SE

Re: Determining table and column access based on query

2019-08-13 Thread Thomas Kellerer
Thomas Rosenstein schrieb am 13.08.2019 um 12:17: > we would like to evaluate what data a SQL query will access, is there > a possibility to ask the Planner directly which tables and columns > will be affected in the end? > explain (verbose) will show the output columns for each step. Is that

Re: SQL equivalint of #incude directive ?

2019-08-30 Thread Thomas Kellerer
stan schrieb am 30.08.2019 um 15:48: I thought this would be common. But a quick Google only revealed what look to be workarounds. I am defining a bunch of functions, and I would prefer to store them in a separate file, which then gets "source" by the main DB init file. Is there a standard way

Re: PG SQL and LIKE clause

2019-09-13 Thread Thomas Kellerer
Matthias Apitz schrieb am 13.09.2019 um 07:28: > We're porting a huge Library Management System, written using all kind > of languages one can think of (C, C++, ESQL/C, Perl, Java, ...) on Linux > from the DBS Sybase to PG, millions of lines of code, which works also > with DBS Oracle and in the pa

Re: Advice for geographically dispersed multi master

2019-10-03 Thread Thomas Kellerer
Nikolai Lusan schrieb am 03.10.2019 um 11:05: I have read the various replication and clustering documentation for postgresql 11, and it looks like what I want is "Synchronous Multimaster Replication". The organisation I am doing this for does not have the money to throw at a commercial solution

Postgres 12: backend crashes when creating non-deterministic collation

2019-10-04 Thread Thomas Kellerer
I was trying to learn how the new non-deterministic collations in v12 work, but the following makes the backend crash: CREATE COLLATION de_ci (provider = icu, locale = 'de-x-icu', deterministic = false); Which leads to: 2019-10-04 11:54:23 CEST LOG: server process (PID 7540) was terminated

Re: Postgres 12: backend crashes when creating non-deterministic collation

2019-10-04 Thread Thomas Kellerer
Laurenz Albe schrieb am 04.10.2019 um 16:04: I was trying to learn how the new non-deterministic collations in v12 work, but the following makes the backend crash: CREATE COLLATION de_ci (provider = icu, locale = 'de-x-icu', deterministic = false); Which leads to: 2019-10-04 11:54:23 CEST LO

Re: Postgres 12: backend crashes when creating non-deterministic collation

2019-10-04 Thread Thomas Kellerer
Daniel Verite schrieb am 04.10.2019 um 18:49: Creating works, but apparently on Windows ICU does not support this. After installing v12 on windows with the EDB installer, I notice that it ships with ICU 53, a relatively old version (2014). Concerning the problem just above (not the crash), ICU

Re: Postgres 12: backend crashes when creating non-deterministic collation

2019-10-04 Thread Thomas Kellerer
Tom Lane schrieb am 04.10.2019 um 16:52: Is it worth the effort to report that through the bug reporting form? No, this thread is a sufficient report. What *would* be a good use of time is to get a stack trace from the crash, if you can. I don't know if I did everything correctly, but here i

Re: Postgres 12: backend crashes when creating non-deterministic collation

2019-10-05 Thread Thomas Kellerer
Tom Lane schrieb am 04.10.2019 um 19:36: Hm. This trace says that the crash happened somewhere down inside ICU itself, during the ucol_open() call in get_collation_actual_version(). There isn't much we could have done to mess up the arguments to that function. That would seem to mean that it's

Re: Postgres 12: backend crashes when creating non-deterministic collation

2019-10-05 Thread Thomas Kellerer
Thomas Kellerer schrieb am 05.10.2019 um 13:39: Hm.  This trace says that the crash happened somewhere down inside ICU itself, during the ucol_open() call in get_collation_actual_version(). There isn't much we could have done to mess up the arguments to that function.  That would seem to

Re: Case Insensitive Comparison with Postgres 12

2019-10-10 Thread Thomas Kellerer
Igal @ Lucee.org schrieb am 10.10.2019 um 14:41: > Thank you all for replying. I tried to use the locale suggested by > both Laurenz and Pavel, en-US-u-ks-level2, but I'm still getting > false for a simple comparison of 'Abc' = 'abc'. I tried the locale > both as a 'string' and as an "identifier"

JSON vs. JSONB storage size

2019-10-11 Thread Thomas Kellerer
I recently stumbled over the presentation "How to Use JSON in MySQL Wrong" by Bill Karwin[1] While most of the indexing part simply doesn't apply to Postgres, I was curious about the statement that the data type of a json value inside the json matters as well (Slide 56) Apparently in MySQL sto

A little confusion about JSON Path

2019-10-16 Thread Thomas Kellerer
Hello, I don't understand why the following two JSON Path expressions aren't doing the same thing in Postgres 12: with sample (data) as ( values ('{"k1": {"list":[1,2,3]}}'::jsonb) ) select data, jsonb_path_exists(data, '$.k1.list.type() ? (@ == "array")'),

Re: A little confusion about JSON Path

2019-10-18 Thread Thomas Kellerer
Laurenz Albe schrieb am 17.10.2019 um 13:25: >> I don't understand why the following two JSON Path expressions aren't doing >> the same thing in Postgres 12: >> >> jsonb_path_exists(data, '$.k1.list.type() ? (@ == "array")'), -- returns >> true as expected >> jsonb_path_exists(data, '$.k1.list

Re: Calling jsonb_array_elements 4 times in the same query

2019-10-21 Thread Thomas Kellerer
Alexander Farber schrieb am 21.10.2019 um 15:39: > I am trying to construct a query, which would draw a game board when given a > move id (aka mid): > >     SELECT >     hand, >     JSONB_ARRAY_ELEMENTS(tiles)->'col' AS col, >     JSONB_ARRAY_ELEMENTS(tiles)->'row' AS row, >     J

Re: Calling jsonb_array_elements 4 times in the same query

2019-10-21 Thread Thomas Kellerer
> I am trying to create the following strored function based on your suggestion > (and I have forgotten to mention, that I also need the board id aka bid from > another table, words_games), but hit the next problem: > > CREATE OR REPLACE FUNCTION words_get_move( >     in_mid inte

Re: Composite type storage overhead

2019-10-23 Thread Thomas Kellerer
> 3. The value is logically defined as a 128-bit integer, that is in > itself a compound value split into a few "bit groups". Extracting > these parts can be done by simple (and supposedly efficient) bitwise > operators when stored as integer, but becomes much more cumbersome > with UUID, I guess.

Re: Search path

2019-10-24 Thread Thomas Kellerer
stan schrieb am 24.10.2019 um 18:41: > I just was educated on the security issues of search path. As a result > I am going to define a schema for the project we are working on. > I set this in postgresql.conf > > search_path = 'ica , "$user", public' > > Here is the question. Will this path be i

Re: Upgrade PGSQL main version without backup/restore all databases?

2019-11-06 Thread Thomas Kellerer
Durumdara schrieb am 06.11.2019 um 14:09: > We have PGSQL 9.6.xxx on a Linux server which heavily used. > More than 100 databases, and more than 300 active users, and it is a master > of a cluster (the data replicated on a slave). > > Somewhere we have read that 9.6 will become unsupported shortl

How to convert return values from JSON Path functions to text

2019-11-06 Thread Thomas Kellerer
The new JSON path functions in Postgres 12 are really convenient, however I cannot figure out how to properly convert their return values to a text value. E.g. select jsonb_path_query_first('{"a": "foo"}', '$.a') returns a JSONB value. Casting it to text, still yields "foo" (with quotes), rather

Re: SQL SERVER migration to PostgreSql

2019-11-07 Thread Thomas Kellerer
İlyas Derse schrieb am 07.11.2019 um 14:28: > I'm trying to migration to PostgreSql from SQL Server. I have Stored > Procedures what have output parameters and returning tables.But you > know what, we can not returning tables in stored procedures in > PostgreSql and we can not use output parameters

Re: INOUT PARAMETERS WITH RETURN TABLES IN FUNCTION

2019-11-08 Thread Thomas Kellerer
İlyas Derse schrieb am 08.11.2019 um 09:18: > I'm trying to migration to PostgreSql from SQL Server.  I have Stored > Procedures what have output parameters and return tables. How can i do both > together.  > > CREATE or replace FUNCTION public."test" (INOUT "x" integer, INOUT "y" > character v

Re: How should I specify work_mem/max_worker_processes if I want to do big queries now and then?

2019-11-20 Thread Thomas Kellerer
James(王旭) schrieb am 20.11.2019 um 08:56: > I am doing a query to fetch about 1000 records in one time. But > the query seems very slow, like "mission impossible". I am very > confident that these records should be fit into my shared_buffers > settings(20G), and my query is totally on my index,

Re: Return Table in StoredProceure/Function

2019-11-20 Thread Thomas Kellerer
İlyas Derse schrieb am 20.11.2019 um 09:18: > How can I return table in Stored Procedure ? I can do it in function but I > have inout parameters.So I can not create in function. What can I do this > case ? > > I guess,It should be like for function : > > CREATE or REPLACE FUNCTION public."test"

Re: Return Table in StoredProceure/Function

2019-11-21 Thread Thomas Kellerer
Tony Shelver schrieb am 21.11.2019 um 07:33: > Well then SQL Server breaks that rule big time :) I am aware of that - but at the end it's essentially the only DBMS (except for Sybase because of their common roots) that works that way. A migration from SQL Server to Oracle (or MySQL or DB2 or Fir

Re: Why are clobs always "0"

2019-12-01 Thread Thomas Kellerer
Arnie Morein schrieb am 01.12.2019 um 18:31: I have tested the most recent driver in three different SQL IDEs, and now with an application I'm writing that uses JDBC metadata, the comment on a field definition also isn't available as a string value. The only thing I ever see regarding data type

Re: upgrade and migrate

2019-12-03 Thread Thomas Kellerer
Michael Paquier schrieb am 04.12.2019 um 05:48: > On Tue, Dec 03, 2019 at 10:32:22PM +, Julie Nishimura wrote: >> Hello, what is the best way to migrate from PostgreSQL 8.3.11 on >> x86_64-redhat-linux-gnu to PostgreSQL 9.6.16 on x86_64-pc-linux-gnu >> server, with minimal downtime? >> The cave

Identity columns, DEFAULT keyword and multi-row inserts

2019-12-09 Thread Thomas Kellerer
Hello, assume the following table: create table test ( id integer not null generated always as identity, data integer not null ); The following insert works fine: insert into test (id, data) values (default,1); However, a multi-row insert like the following:

Re: Identity columns, DEFAULT keyword and multi-row inserts

2019-12-10 Thread Thomas Kellerer
Patrick FICHE schrieb am 10.12.2019 um 08:56: >> -Original Message- >> From: Thomas Kellerer >> >> assume the following table: >> >> create table test >> ( >> id integer not null generated always as identity, >>

Re: READ UNCOMMITTED in postgres

2019-12-18 Thread Thomas Kellerer
Matthew Phillips schrieb am 19.12.2019 um 00:12: > Hi, With the current READ UNCOMMITTED discussion happening on > pgsql-hackers [1], It did raise a question/use-case I recently > encountered and could not find a satisfactory solution for. If > someone is attempting to poll for new records on a hig

Re: BigSQL pgc alternative

2019-12-22 Thread Thomas Kellerer
Samuel Teixeira Santos schrieb am 20.12.2019 um 16:15: BigSQL still allow to install Postgres and others resources as like a portable install. But today, it's only offer your tool (pgc) for newer Postgresql versions. I would like to install as portable option because it's more easy to config an

Re: SQL operator '*='

2019-12-23 Thread Thomas Kellerer
Matthias Apitz schrieb am 23.12.2019 um 15:33: I've here a smaller problem of our porting from Sybase/Oracle/Informix code to PostgreSQL; the code reads for the mentioned DBS: #ifdef DBSORA EXEC SQL DECLARE land_cursor CURSOR FOR SELECT stammprio, lkz, landbez, plkz, pos

Re: Date created for tables

2019-12-24 Thread Thomas Kellerer
Ron schrieb am 24.12.2019 um 03:14: Having moved to PostgreSQL from Oracle a few years ago I have been generally very impressed by Postgres, but there are a few things that I still miss. One of those is being able to see the created and last modified dates for database objects. Is this something

Re: How can I set a timeout for a locked table in Function ?

2020-01-03 Thread Thomas Kellerer
Michael Lewis schrieb am 03.01.2020 um 18:00: Why take an exclusive lock on an entire table to update a single row? That's what I was asking myself as well.

Re: Multiple Aggregations Order

2020-01-14 Thread Thomas Kellerer
João Haas schrieb am 14.01.2020 um 18:26: I'm working on a query where I need to fetch information from a table along with some data from a many-to-many connection table in a single query. My idea is to do an outer join with the connection query and aggregate the needed data in multiple 'array_ag

Re: Declare variable from other variable

2020-02-05 Thread Thomas Kellerer
Raul Kaubi schrieb am 05.02.2020 um 12:21: > How can I declare another variable from another variable. > Basically from oracle, I can just:  > > var1 := 'asda'||var2; > > In postgres, I have the following example, I would like to use variable j to > add number of months there. > > " interv

Re: Backup & Restore

2020-02-25 Thread Thomas Kellerer
sivapostg...@yahoo.com schrieb am 25.02.2020 um 02:55: > Can u suggest a good backup solution for a windows installation ? > Looks like the suggested two [ pgbarman, pgbackrest ] works only in > Linux. pg_probackup provides Windows binaries: https://github.com/postgrespro/pg_probackup/

Re: Postgresql 12.x on Windows (vs Linux)

2020-03-02 Thread Thomas Kellerer
Robert Ford schrieb am 02.03.2020 um 15:42: > I am aware that this might be a broad question, but I am not > expecting *very *specific answers either: > > When it come to running a modern PostgreSQL server, which serves say > 1 TB of data, are there substantial differences in performance > betwee

Re: How to get RAISE INFO in JDBC

2020-03-20 Thread Thomas Kellerer
Ravi Krishna schrieb am 20.03.2020 um 15:48: How do we get the notification mentioned in RAISE INFO of PL/PGSQL in JDBC. I can get it in psql, but not in JDBC. I am talking about redshift which has the same procedural language like postgres. I can only answer this for Postgres. As Redhisft ha

Re: dbeaver

2020-04-01 Thread Thomas Kellerer
negora schrieb am 01.04.2020 um 21:44: It has lots of useful features, such as good query completion, row coloring, virtual columns, virtual foreign keys What kind of feature is "virtual foreign keys"? Or "virtual columns" in the context of a SQL GUI tool

Re: script libraries?

2020-04-30 Thread Thomas Kellerer
Chris Stephens schrieb am 30.04.2020 um 15:54: as another Oracle DBA trying to pick up Postgresql one thing i haven't come across are script libraries such as there are for Oracle (https://github.com/tanelpoder/tpt-oracle and https://oracle-base.com/dba/scripts as examples). Does anything like t

Re: pg_temp schema created while using DB Link

2020-05-08 Thread Thomas Kellerer
Jill Jade schrieb am 08.05.2020 um 09:32: > We do not have any temporary tables in the Oracle database. The > temporary schema is created only while using the db_link. These temp > schemas (pg_temp, pg_toast) are not disappearing even after > restarting the database. The temp tables would be creat

Re: Oracle vs. PostgreSQL - a comment

2020-06-01 Thread Thomas Kellerer
Stefan Knecht schrieb am 01.06.2020 um 07:36: Oracle is also the single most feature-rich database out there - the feature set of Postgres isn't even 1% of what Oracle has. I try to stay out of discussions like this, but the above is simply not true. Oracle indeed has more features but 1% is b

Re: Using JSONB with nested key-value structures, and skipping/wildcarding the key

2020-06-02 Thread Thomas Kellerer
> One question: as a novice here, I think I understand the right hand > side of your JOIN "... k(value)" is shorthand for: > > ... AS table_name(column_name) > > except that I don't see any clues in the docs that > jsonb_object_keys() is a "table function".> Can you kindly clarify? The clue is in

Re: Oracle vs. PostgreSQL - a comment

2020-06-02 Thread Thomas Kellerer
Ron schrieb am 02.06.2020 um 20:38:    PG's individual clusters are relatively lightweight, after all. But require a new port, and Enterprises have Processes that must be followed. I am not 100% sure, but I think you can get around that by putting pgPool or pgBouncer in front and make all

Re: Monitoring for long running transactions

2020-06-04 Thread Thomas Kellerer
Samuel Smith schrieb am 04.06.2020 um 21:59: Sorry, I should have clarified that I was aware of the pg_stat_activity table. That is how we found the problem in the first place. And yes I could just write a bash script and run it in cron. I just didn't know if there was a more "official" way to go

Re: Oracle vs. PostgreSQL - a comment

2020-06-05 Thread Thomas Kellerer
Achilleas Mantzios schrieb am 05.06.2020 um 14:05: >> Plus PG does not directly support cross database queries using 3 part name, >> something >> sqlserver excels at. > > Maybe because SQL server does not have real databases but schemas instead ? > This sucks security wise. That is wrong. SQL Se

Re: checking existence of a table before updating its SERIAL

2020-06-08 Thread Thomas Kellerer
Matthias Apitz schrieb am 08.06.2020 um 09:53: > We're updating the SERIAL of a bunch of tables with a SQL script which > does for any table: > > /* table: idm_tasktab */ > DO $$ > DECLARE > max_id int; > BEGIN > SELECT INTO max_id GREATEST(COALESCE(max(taskid), 0),0) + 1 FROM > idm_tasktab; >

  1   2   3   4   >