Can a broken Postgresql data directory be reconstructed without losing data?

2018-04-15 Thread A A
I'm trying to restore a database from a broken data directory that have lost many of its files accidentally. I have tried unsuccessfully to install new instance of the same Postgresql version and then copy (with overwrite) the broken datadir to the new one.here the remaining datadir tha

Re: Can a broken Postgresql data directory be reconstructed without losing data?

2018-04-15 Thread A A
Well this doesn't address the question at all. On Sunday, April 15, 2018, 1:44:00 PM GMT+2, Ricardo Martin Gomez wrote: You must to restore a database from a backup. Regards. Obtener Outlook para Android From: A A Sent: Sunday, April 15, 2018 5:25:05 AM To: pgsql-ge

Questions on user defined data types

2018-04-24 Thread a
Hi there: I want to ask the if I could define an object like type in postgresql, it may be better to illustrate with actual examples. Background information: 1, I would like to pack group of data into 1 entry of in a table. 2, The table consist some financial product information

Questions on input function of TOAST enabled user defined types

2018-04-24 Thread a
f the data is also needed, so Datum type would be not enough since it only provide a pointer to the data. So what should I do if I would have a TOAST enabled user defined data types, should I use other type such as struct varlena as return type?? Thanks so much!!

Parameter passing in trigger function write in C

2018-04-26 Thread a
Hey everyone: I was request to write a trigger that perform the following function: 1, The trigger will be set to exam all statement that will result change of datas 2, The trigger will exam three information other than the data updated or inserted: user name, password and reasons of

Re: Parameter passing in trigger function write in C

2018-04-26 Thread a
uot;Adrian Klaver"; Date: Friday, Apr 27, 2018 9:36 AM To: "a"<372660...@qq.com>; "pgsql-general"; Subject: Re: Parameter passing in trigger function write in C On 04/26/2018 06:13 PM, a wrote: > Hey everyone: > > I was request to write a trigger that p

Re: Parameter passing in trigger function write in C

2018-04-27 Thread a
Yep, I wanna pass the brief reason of manipulating(update, insert or delete), name and password of the manipulator (This might be done by database itself). -- Original -- From: "Adrian Klaver"; Date: Friday, Apr 27, 2018 10:16 PM To: "a&qu

Is it possible to get username information while writing trigger?

2018-05-07 Thread a
Hey: What I want is to add a log entry at the last column of each row, which will record the history update, insert automatically when relative statement is processed. I have read the documentation on triggers, which helps a lot. However, I may have few more extra requirement to complete my

Re: Is it possible to get username information while writingtrigger?

2018-05-07 Thread a
Thank you for your reply; Please allow me to ask few more questions: 1, Since I'm writing a C trigger function, is there any method for me to get some of the basic information like the follow: (1) Total number of rows; (2) Rows' names; (3) Value of OLD and NEW; 2

How to manipulate tuples in C functions?

2018-05-07 Thread a
Hey all: As far as I know, composite type and rows (trigger functions) are passed between PostgreSQL and C functions as tuple. However, I rarely find things relating on how to manipulate a tuple under C from documentation. The only thing I can find from the doc is very simple stuff like

How do I get the SQL statement in a trigger?

2018-05-10 Thread a
Hi I would like to write a trigger that recorded every sql statement under the effected entry. So if it is possible to retrieve the sql statement within a trigger??

Re: How do I get the SQL statement in a trigger?

2018-05-10 Thread a
Thanks a lot, would you please be so kind to tell me more about what is top level query?? -- Original message -- From: "Pavel Stehule"; Sendtime: Thursday, May 10, 2018 6:38 PM To: "a"<372660...@qq.com>; Cc: "pgsql-general"

Is there any C functions that convert the entry to string?

2018-05-10 Thread a
Saying that I am writing a C function that may facing varies of types. Is there a postgresql function that will automatically call the relative to_string function and transform them to string??

How can I retrieve attribute category with attribute Oid in C function?

2018-05-14 Thread a
Hi I am writing something that would need to identify the attribute category inside a C function, now I may need a way of fast access it, but the information is not stored in FormData_pg_attribute structure. Can anyone help? Thanks a lot!!! Shore

Re: How can I retrieve attribute category with attribute Oid in Cfunction?

2018-05-14 Thread a
hey thank you!! could you provide some more detail information?? What function should I use to get FormData_pg_type structure?? thanks a lot -- Original message -- From: "Laurenz Albe"; Sendtime: Monday, May 14, 2018 4:11 PM To: "a&qu

Re: How can I retrieve attribute category with attribute Oid in Cfunction?

2018-05-14 Thread a
BTW, I searched another function called "lookup_type_cache", which will return a pointer of structure of "TypeCacheEntry". The structure contains "TypeCacheEntry.typtype" that may also help to identify the type. But I'm concerning about possible memory le

What is the C function to modify attribute

2018-05-16 Thread a
Hi: I am writing a trigger that will record all adjustment of the row into the last column of the row. I have done a iterator to produce text record and the last step would be add the text record into the last column (which designed as an array of user defined type, with the output function

Importing data from CSV into a table with array and composite types

2018-05-18 Thread a
Hi: I would like to import data from a csv table. But the table that is going to be inserted is constructed with arrays and composite types, also with array of composite. I have tried many ways of inserting but fail. Can anyone help? Thank you so much.

Re: Importing data from CSV into a table with array and composite types

2018-05-19 Thread a
Thank you so much. BTW, may I ask one more question that, how should I select every first element of the array?? I know that "select p[:] from f" will print all element of the p array, but I probably would want to present result as "select p[:].a from f", but the sta

How do I copy an element of composite type array into csv file?

2018-05-23 Thread a
Hi suppose I have composite type and table create type A as( x float8, y float8 ); create table B( Ay A[] ); insert into B values(array[ (1,2)::A, (3,4)::B] ); Now I would like to export the first element of table B into an csv file: COPY B(Ay[1]) to 'E:/product

Re: How do I copy an element of composite type array into csv file?

2018-05-23 Thread a
uot;amul sul";; Send time: Wednesday, May 23, 2018 5:11 PM To: "a"<372660...@qq.com>; Cc: "pgsql-general"; Subject: Re: How do I copy an element of composite type array into csv file? On Wed, May 23, 2018 at 2:05 PM, a <372660...@qq.com> wrote: > Hi supp

How do I select composite array element that satisfy specific conditions.

2018-05-23 Thread a
Hi, say if I have composite type and table create type A as( x float8, y float8 ); create table B( Ay A[] ); insert into B values(array[ (1,2)::A, (3,4)::A] ); How could I select the element of Ay that satisfy x=3?? Thank you so much!! Shore

Re: RE: How do I select composite array element that satisfy specific conditions.

2018-05-23 Thread a
Thanks for your reply... Honestly I do not use java and don't really know json. All I understand is that it is a text format that allow some customization. However, as long as it can solve my problem, I'm happy to learn it. now I do have a complex structure of data to store

Re:RE: RE: How do I select composite array element that satisfy specific conditions.

2018-05-23 Thread a
Thank you so much, I may discuss more on what I am doing so that it might have a clearer version for me and if you would be so kind to provide your opinions on this. The target industry is insurance industry and the table is used to hold policy data for insurance company. The key reason for

Re:How do I copy an element of composite type array into csv file?

2018-05-23 Thread a
Thank you so much, did you mean the section 8.15.6?? -- Original message -- From: "David G. Johnston"; Sendtime: Wednesday, May 23, 2018 9:18 PM To: "a"<372660...@qq.com>; Cc: "amul sul"; "pgsql-general"; Subje

Re: RE: RE: How do I select composite array element that satisfyspecific conditions.

2018-05-23 Thread a
Thank you so much for you suggestion, it is probably a better way to normalize the data to a policy data an using multiple tables. The millions of table is not true (but there are around 60 database instances), but the hundreds of lines of query are the actual queries provided by current db

pgagent jobs is not running

2018-06-10 Thread a
Hi I'm setting up agent jobs for postgresql. I'm on win server 2008, and postgresql 10. I set up the jobs using pgadmin 4.3. however, the job is not executing, may I ask why??

where I can find the error message for pgagent jobs

2018-06-10 Thread a
Hi all I set up a pgagent job, but it says the job was failed. But where I can have a look on error report message?? I'm using pgadmin 4.3, pgagent 3.4, postgresql 10, the platform is windows server 2008 Thank you so much.

Re: where I can find the error message for pgagent jobs

2018-06-10 Thread a
Hey thanks so much. I found the error msg as "Couldn't get a connection to the database!" I've searched internet with the issue, some may say replace pgpass.conf as follow: "localhost:5432:[dbname]:postgres:[password]" but after I changed, the job returns a

Re: where I can find the error message for pgagent jobs

2018-06-10 Thread a
Hey, the following is the table : 1 1 1 "f" 1 "2018-06-11 11:38:33.163731+08" "00:00:00.033002" "Couldn't get a connection to the database!" 2 2 1 "f" 1 "2018-06-11

Does pgAgent support chinese, japanese characters?

2018-06-12 Thread a
Hi I'm using pgAgent to set up daily or monthly tasks. I have tables that with the name of Chinese or Japanese. It runs ok in normal sql script, but report non-recognizable in pgAgent SQL jobs. I'm using windows server 2008, pgsql 10, and pgAgent 3.4, may there be a way of

Re: Does pgAgent support chinese, japanese characters?

2018-06-12 Thread a
Thanks a lot for your reply. I tried to set the host/client encoding, however, when I create new tables using Chinese, it reported an encoding error.. also with other queries. May I ask encoding of pgAgent? May it reading from a text file? Or I can use notepad++ to convert and then

How can I retrieve double or int data type for libpq

2018-06-12 Thread a
Hi I wanna use C library to connect pgsql server and I got 2 questions: 1, If I can fetch a row's data instead of using PQgetvalue? 2, PQgetvalue will return all data as text, I would have to convert them into the relative data type, is there a way of getting data by its original f

How to reference a composite type in schemas not "public"?

2018-06-13 Thread a
rom public, while I would like to create table using the composite type, it reports a error: create type "MjorTbl".decrmt as( nodecrmt int4, mortality "MjorTbl"."mort" ); ERROR: type "MjorTbl.mort" does

Re: How to reference a composite type in schemas not "public"?

2018-06-13 Thread a
Hey thank you~ postgres=# \dn | ?? -+-- pgagent | postgres public | postgres (2 ??) -- Original -- From: "Adrian Klaver"; Date: Thursday, Jun 14, 2018 12:06 PM To: "a"<372660...@

Re: How to reference a composite type in schemas not "public"?

2018-06-13 Thread a
Sorry I was in the wrong db last time TESTDB=# \dn | ?? -+-- MjorTbl | postgres Rate| postgres public | postgres -- Original -- From: "Adrian Klaver";; Date: Jun 14, 2018 To: "a&qu

How can I stop a long run pgAgent job?

2018-06-21 Thread a
Hi I'm using pgAdmin 4, pgAgent and postgresql 10 on windows server. I tried a job but due to some reasons, its running long time. Is there a way that I can terminate it ?? Thanks Shore

Reporting bug on pgAdmin 4.3

2018-07-09 Thread a
Hi I'm doing a normal query on pgAdmin, my server platform is win server 2008, my laptop is win10, both using pgsql 10. The results of the query shows 8488 rows are selected, which is correct. However, when I drag down in data output window, it shows more than 10 rows. Further

Re: Reporting bug on pgAdmin 4.3

2018-07-10 Thread a
Hi, since I'm not with the test environment so there may be not very exact answers. 1, The data was set to load from oracle server at 0 am of each work day. There are 3 ways to determine the right results: a. data from oracle server; b. there is going to be a statement summary in

Re: Reporting bug on pgAdmin 4.3

2018-07-10 Thread a
Hey, I fixed the problem by using web pgadmin also with a upgrade to 4.3.1. So I installed pgadmin 4.3 under the location of .\PostgreSQL\10\pgadmin, so it will start up a window instead of a web viewer. I deleted it and re-installed the 4.3.1 and started it with web browser, the problem

How to split an array into columns

2018-08-24 Thread a
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 I would have around 200,000 rows, I would prefer it having

Ways to deal with large amount of columns;

2018-08-30 Thread a
Hi all: I need to make a table contains projected monthly cashflow for multiple agents (10,000 around). Therefore, the column number would be 1000+. I would need to perform simple aggregate function such as count, sum or average on each cashflow projected. So if there is anyway of doing

Re: Ways to deal with large amount of columns;

2018-08-30 Thread a
Sendtime: Friday, Aug 31, 2018 6:24 AM To: "a"<372660...@qq.com>; Cc: "pgsql-general"; Subject: Re: Ways to deal with large amount of columns; a <372660...@qq.com> writes: > Hi all: > > > I need to make a table contains projected monthly cashflow f

Re: Ways to deal with large amount of columns;

2018-08-30 Thread a
Thank you very much. Creating a function seems to be a good idea :) -- Original message -- From: "David G. Johnston"; Sendtime: Thursday, Aug 30, 2018 8:31 PM To: "a"<372660...@qq.com>; Cc: "pgsql-general"; Subject: R

How to insert bulk data with libpq in C?

2018-12-17 Thread a
May I ask the proper (fast) way of inserting bulk data and if possible, an example would be very appreciated. Please note that the data I would like to insert contains arrays (float8[]). By the way, my environment is Windows 10, PostgreSQL 11 and compiling with Visual Studio 2017.

pgpool, pgmaster and pgslave migration to ubuntu 18.04

2019-07-08 Thread a venkatesh
Hi, I'm exploring the options to migrate postgresql master, slave along with pgpool from ubuntu14.04 to 18.04. Please help me understand the following. 1. What are the available options for migrating from one version of O/S to the other (Here ubuntu 14.04 to 18.04) ? 2. Document references. 3. An

Compression In Postgresql 9.6

2019-08-04 Thread Shital A
Hello, Need inputs on below: We are working on a setting up a new highly transactional (tps 100k) OLTP system for payments using blockchain and postgresql 9.6 as DB on Rhel 7.6. Postgres version is 9.6 and not latest because of specs of blockchain component. There is a requirement for data

Re: Compression In Postgresql 9.6

2019-08-05 Thread Shital A
On Mon, 5 Aug 2019, 12:42 Ron, wrote: > On 8/5/19 1:30 AM, Shital A wrote: > > Hello, > > > > Need inputs on below: > > > > We are working on a setting up a new highly transactional (tps 100k) > OLTP > > system for payments using blockchain and postgr

Re: Compression In Postgresql 9.6

2019-08-06 Thread Shital A
this imply that either his table is partitioned or he > > regularly moves records from the main table to the archive table? > > > > Hi, > > Yes, he will need to do something to meet his goal of both a 100k TPS > and have older archives online. He could also use something like > po

Generate test data inserts - 1GB

2019-08-09 Thread Shital A
Hello Postgresql 9.6 Need to generate 1GB test data in very less time. I got some techniques online but they take around 40mins for 400GB. Any quicker way? Thanks.

Re: Generate test data inserts - 1GB

2019-08-09 Thread Shital A
On Fri, 9 Aug 2019, 20:08 Adrian Klaver, wrote: > On 8/9/19 4:12 AM, Shital A wrote: > > Hello > > > > Postgresql 9.6 > > > > Need to generate 1GB test data in very less time. I got some techniques > > online but they take around 40mins for 400GB. Any quic

Re: Generate test data inserts - 1GB

2019-08-09 Thread Shital A
On Fri, 9 Aug 2019, 21:25 Adrian Klaver, wrote: > On 8/9/19 8:14 AM, Shital A wrote: > > > > > Hello, > > > > > 4) What techniques have you tried? > > Insert into with With statement, inserting 200 rows at a time. This > > takes 40 mins. >

Fwd: Postgres HA - pacemaker RA do not support auto failback

2019-08-12 Thread Shital A
ow: 1. Cluster is setup like A - B with A as master. 2. Kill services on A, node B will come up as master. 3. node A is ready to join the cluster, we have to delete the lock file it creates on any one of the node and execute the cleanup command to get the node back as standby Step 3 is manual so HA i

Re: Fwd: Postgres HA - pacemaker RA do not support auto failback

2019-08-12 Thread Shital A
On Mon, 12 Aug 2019, 18:54 Adrien Nayrat, wrote: > On 8/12/19 2:57 PM, Shital A wrote: > > > > > > Hello, > > > > Postgres version : 9.6 > > OS:Rhel 7.6 > > > > We are working on HA setup for postgres cluster of two nodes in > active-pas

Re: Fwd: Postgres HA - pacemaker RA do not support auto failback

2019-08-13 Thread Shital A
On Tue, 13 Aug 2019, 11:50 Shital A, wrote: > > > On Mon, 12 Aug 2019, 18:54 Adrien Nayrat, > wrote: > >> On 8/12/19 2:57 PM, Shital A wrote: >> > >> > >> > Hello, >> > >> > Postgres version : 9.6 >> > OS:Rhel 7.

Re: Pgsql resource agent of pacemaker

2019-08-19 Thread Shital A
On Mon, 19 Aug 2019, 18:47 Shital A, wrote: > Hello, > > Need advise on below situation: > > Postgres 9.6 > Pacemaker 1.1.19 > Corosync 2.4.3 > > We are testing HA setup on a two node cluster using pacemaker, corosync > stack. The replication is streaming replica

Re: Pgsql resource agent of pacemaker

2019-08-20 Thread Shital A
On Mon, 19 Aug 2019, 23:36 Shital A, wrote: > > > On Mon, 19 Aug 2019, 18:47 Shital A, wrote: > >> Hello, >> >> Need advise on below situation: >> >> Postgres 9.6 >> Pacemaker 1.1.19 >> Corosync 2.4.3 >> >> We are testing HA s

max_connections parameter: too_many_connections error

2019-09-17 Thread Shital A
*Hello*, We are working on a payments systems which uses postgreSql 9.6 as backend DB and blockchain technology. The database is setup in HA in master-standby mode using pacemaker on Linux 7.6. *We are new to postgres and ne*ed help in deciding how to set value for max_connections on DB. 1. How

Help: Postgres Replication issues with pacemaker

2019-09-22 Thread Shital A
Hello, We have setup active-passive cluster using streaming replication on Rhe 7.5. We are testing pacemaker for automated failover. We are seeing below issues with the setup : 1. When a failoveris triggered when data is being added to the primary by killing primary (killall -9 postgres), the

Re: Help: Postgres Replication issues with pacemaker

2019-09-22 Thread Shital A
On Mon, 23 Sep 2019, 00:46 Shital A, wrote: > > Hello, > > We have setup active-passive cluster using streaming replication on Rhe > 7.5. We are testing pacemaker for automated failover. > We are seeing below issues with the setup : > > 1. When a failoveris triggered whe

Need help : pgsql HA issues

2019-09-30 Thread Shital A
*Hello All,* We are in process of testing a Postgres 9.6 active-passive HA cluster using streaming replication on Rhel 7.5. We are seeing below issue with the setup : 1. When a failover is triggered while data is being added to the primary by killing primary (killall -9 postgres), the failed

Urgent :: Postgresql streaming replication issue - sync mode

2019-10-02 Thread Shital A
Hello, We are seeing a strange issue with postgresql streaming application in sync mode. We are using postgresql 9.6. Old version because of some specific requirements. We have setup cluster with master-standby using pacemaker. When we kill master using killall -9 postgres. The failed primary

Re: Urgent :: Postgresql streaming replication issue - sync mode

2019-10-02 Thread Shital A
On Thu, 3 Oct 2019, 00:08 Ravi Krishna, wrote: > > > > As the failed primary is having more data, How is it possible that > primary is committing transaction before they were applied on standby with > synchronous_commit=remote_apply? > > If I am not mistaken remote_apply is only from ver 11. > H

Re: Urgent :: Postgresql streaming replication issue - sync mode

2019-10-02 Thread Shital A
le the extra data at the master. I'm not sure what would happen but > killall in general is a dangerous command. > > On Thu, 3 Oct 2019, 7:00 am Shital A, wrote: > >> >> >> On Thu, 3 Oct 2019, 00:08 Ravi Krishna, wrote: >> >>> > >>> >

pgpool High Availability Issue

2019-11-15 Thread a venkatesh
Hi, I'm working on configuring high availability for pgpool using watchdog. Initially, I tried with two pgpool nodes (along with a pgmaster and pgslave). In this scenario, assuming pgpool node 1 was started first and became the leader. After sometime , the node got disconnected with pgpool

Question about attention to pgsql-hack...@lists.postgresql.org

2022-06-26 Thread A Z
Dear pgsql-general, I have successfully sent an (updated) email list message to pgsql-hack...@lists.postgresql.org which can be viewed in the archive here: https://www.postgresql.org/message-id/Rm7WBtZZpYL1NWuunuN_16EY0JcyejqV22z_JlUfvD5FYPenGDd_ZGUddwAcMNi2KNSyvqAhBRzj2JxtJoNmWAzykBQU4Z1AzBp0G

Postgresql professional certification

2023-03-23 Thread MS A
Hi Team, My name is Sabjar Ali working for one of the MNC companies, I am planning to do Postgresql professional certification. Regarding the same i don't find any link in postgresql.org site. Please help me how i can approach to do my Postgresql professional certification. Thanks Sabjar Ali

Query reg. postgresql 9.6 migration from ubuntu 16.04 to 18.04

2019-05-22 Thread a venkatesh
Hi, I'm working on migrating postgresql 9.6 database from ubuntu 16.04 to 18.04. Please let me know if there are any document references and best practices that can be followed. Thanks, venkatesh.

Re: Query reg. postgresql 9.6 migration from ubuntu 16.04 to 18.04

2019-05-29 Thread a venkatesh
Thanks your response. Please check the following details. 1) Size of Postgres cluster. A. The number of nodes per cluster are 3 - 1 pgmaster, 1 pgslave and 1 pgpool. There are clusters of multiple sizes - 500 GB, < 500 GB and a few higher than that. 2) Method of migration: Dump/rest

Cannot link against libpq on macOS

2023-09-20 Thread A. Reichstadt
Hello, I have been struggling with trying to use a current version of libpq to link against on macOS in Xcode. It seems that nothing works, nobody on the web eventually succeeded either as far as I found so far. I try to write a small sample client. I started with the public source download to

How to deny access to Postgres when connected from host/non-local

2021-04-03 Thread A. Reichstadt
Hello, I try to deny access to all databases on my server if the user “postgres" tries to connect from a non-local host. Here is what I did in pg_hba.conf: # TYPE DATABASEUSERADDRESS METHOD # "local" is for Unix domain socket connections o

Re: How to deny access to Postgres when connected from host/non-local

2021-04-05 Thread A. Reichstadt
Thanks, works. Sent from my iPhone > On Apr 3, 2021, at 11:02, Joe Conway wrote: > > On 4/2/21 7:06 PM, A. Reichstadt wrote: >> Hello, >> I try to deny access to all databases on my server if the user “postgres" >> tries to connect from a non-local host. H

Series of 10 questions about the use of postgresql, generally.

2021-08-05 Thread A Z
, online, free for commercial use? With function support, too? Can someone reply with a link or a suggestion? 1. If I am using the COPY command for input and output around *.csv files, how may I specify internal tuple delimiters of ',', but at the same time also specify an end of line

PostgreSQL general set of Questions.

2021-08-08 Thread A Z
1) Are there free scripts for CREATE TYPE (native type), more advanced, or sorts of types out there, online, free for commercial use? With function support, too? Can someone reply with a link or a suggestion? 2) How may I get PostgreSQL to output the create table statement(s) for one or more

Serious List of PostgreSQL usage questions.

2021-08-09 Thread A Z
1) Are there free scripts for CREATE TYPE (native type), more advanced, or sorts of types out there, online, free for commercial use? With function support, too? Can someone reply with a link or a suggestion? 2) How may I get PostgreSQL to output the create table statement(s) for one or more

Serious Assistance with PostgreSQL True Infinite Arbitrary Precision Maths.

2021-08-11 Thread A Z
e. I am aware of the pgmp project. While I have contacted it and and am awaiting their response, it is the case that the present state of pgmp is not enough for my needs. PostgreSQL does not have a private doubly linked list available, and so I can't assemble all this for myself, given tha

Serious Assistance with PostgreSQL True Infinite Arbitrary Precision Maths.

2021-08-17 Thread A Z
e. I am aware of the pgmp project. While I have contacted it and and am awaiting their response, it is the case that the present state of pgmp is not enough for my needs. PostgreSQL does not have a private doubly linked list available, and so I can't assemble all this for myself, given tha

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

2021-08-18 Thread A Z
'What I am trying to find is PostgreSQL support for High Precision numbers, running inside the database engine itself. PostgreSQL, presently at default, has only got limited function support, on the range of a double.' My needs for High Precision Arithmetic require new types and lo

Question about creation of a new PostgreSQL Extension.

2021-09-01 Thread A Z
To who it may concern, I am trying to get a project completed to enhance PostgreSQL arithmetic and elementary functions prowess by means of two new High Precision mixed decimal number types in a self installing extension. Hopefully, I want this to be a free or low cost project. Is there

Basic Questions about PostgreSQL.

2021-09-14 Thread A Z
-In PostgreSQL, what is the difference between Roles, Groups, and Policies exactly? What are they each, how do they relate to one another, and which one(s) can be assigned to another? -Is there a simple, immediate, straightforward way to temporarily disable PostgreSQL database use of all other

Naked EXISTS vs SELECT EXISTS very different performance.

2021-11-01 Thread Jimmy A
Hi everyone. Can someone tell me why these two equivalent queries, one involving a "naked" EXISTS versus one involving an EXISTS inside a SELECT statement perform so differently? I can see that the slow one scans the entire child table while the fast one only scans children that hav

Re: increasing effective_cache_size slows down join queries by a factor of 4000x

2022-02-03 Thread A Shaposhnikov
I made a mistake yesterday claiming that the created statistics changed the row counts in the estimates - it did not - I looked at the wrong query yesterday. In the correct query plan the row estimate still differs from the actual by many orders of magnitude: Nested Loop (cost=1.01..27584834.53

Re: increasing effective_cache_size slows down join queries by a factor of 4000x

2022-02-03 Thread A Shaposhnikov
y low cost regardless of size. Another guess is that it almost ignores the "limit" parameter or uses it in some incorrect way. On Thu, Feb 3, 2022 at 12:31 PM Vijaykumar Jain wrote: > > > On Fri, 4 Feb 2022 at 01:03, A Shaposhnikov wrote: >> >> I made a mistake yeste

Re: increasing effective_cache_size slows down join queries by a factor of 4000x

2022-02-03 Thread A Shaposhnikov
imizer would be able to infer it itself. Thank you On Thu, Feb 3, 2022 at 4:24 PM Tomas Vondra wrote: > > > > On 2/3/22 20:32, A Shaposhnikov wrote: > > I made a mistake yesterday claiming that the created statistics > > changed the row counts in the estimates - it did no

Re: increasing effective_cache_size slows down join queries by a factor of 4000x

2022-02-14 Thread A Shaposhnikov
I started using the latest postgres 14.2 and the query plans there for a simplified query joining just 2 tables look like: explain analyze select t.*, ta.* from team as t, team_aliases as ta where ta.team_id = t.id and t.id > 2 order by t.id limit 1000; QUERY P

User-defined function with anyrange[]

2018-07-05 Thread Paul A Jungwirth
Hello, I want to make an aggregate function range_agg(anyrange) that returns anyrange[]. But when I try to define it, Postgres tells me it doesn't know what an anyrange[] is. I get this error: ERROR: type anyrange[] does not exist I also tried taking an anyrange and returning an anyarray, which

Re: User-defined function with anyrange[]

2018-07-08 Thread Paul A Jungwirth
b.com/pjungwir/range_agg In the README I give instructions to create a new aggregate with a custom range type, and it is actually not bad at all, since the same C function can serve as implementation in all cases. Thanks again, Paul

Re: How to split an array into columns

2018-08-24 Thread Paul A Jungwirth
On Fri, Aug 24, 2018 at 2:01 AM, a <372660...@qq.com> wrote: > > Say if I have an float8 array: > > id| data > --|--- > a | {1,2} > b | {2,4} > > . . . > > Since I would have around 200,000 rows, I would prefer it having enough > capacit

Re: Table cannot be partiotioned using domain in argument

2018-09-11 Thread Márcio A . Sepp
Hi and thanks for answer, Nope.  The problem is suggested, if not exactly clearly explained, by the error message: casting a literal to ddate isn't a guaranteed fixed process. Wasn't clear enought to me.For example, suppose you created this table and then did alter domain ddate

flinfo NULL in DirectFunctionCall callee?

2019-08-26 Thread Paul A Jungwirth
Hello, I'm writing a multirange_cmp function which calls range_cmp to compare individual elements. It looks like this: cmp = DatumGetInt32(DirectFunctionCall2( range_cmp, RangeTypePGetDatum(r1), RangeTypePGetDatum(r2))); But I get a segfault when range_cmp tries to

Re: flinfo NULL in DirectFunctionCall callee?

2019-08-26 Thread Paul A Jungwirth
On Mon, Aug 26, 2019 at 8:12 AM Tom Lane wrote: > > Paul A Jungwirth writes: > > Is it expected for flinfo to be null when using DirectFunctionCall*? > > Yes, per the comment on those functions: > > * These are for invocation of a specifically named function with

Re: Work hours?

2019-08-27 Thread Paul A Jungwirth
On Tue, Aug 27, 2019 at 3:27 PM stan wrote: > I need to write a function that, given a month, and a year as input returns > the "work hours" in that month. In other words something like > > 8 * the count of all days in the range Monday to Friday) within that > calendar m

When does Postgres use binary I/O?

2019-09-17 Thread Paul A Jungwirth
ge report says they aren't tested, nor are the send/recv functions for ranges or arrays. When does Postgres actually use these functions? Is there a good way to test them? Thanks, Paul [1] https://www.postgresql.org/docs/11/xtypes.html [2] http://www.myrkraverk.com/blog/2019/08/postgresql-r

Re: When does Postgres use binary I/O?

2019-09-22 Thread Paul A Jungwirth
On Sun, Sep 22, 2019 at 11:53 AM Tom Lane wrote: > I thought of an easier-to-maintain approach to that part than having > a reference file. Binary send functions are invokable from SQL, > so we could just imagine adding test cases along the lines of > > regression=# sel

Re: jsonb_set() strictness considered harmful to data

2019-10-20 Thread Paul A Jungwirth
> That said, I think it is reasonable that a PostgreSQL JSON function > behaves in the way that JSON users would expect, so here is my +1 for > interpreting an SQL NULL as a JSON null in the above case Just to chime in as another application developer: the current functionality does se

Rules documentation example

2019-11-11 Thread Paul A Jungwirth
Hello, I'm reading the docs about the Postgres Rule system here: https://www.postgresql.org/docs/12/rules-views.html That page says: > It turns out that the planner will collapse this tree into a two-level query > tree: the bottommost SELECT commands will be “pulled up” into

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Paul A Jungwirth
lex except for tablex.col1 AND tablex.col2, and > also select tabley.col1" > ? I take the proposal to mean this: SELECT listOfColumns [EXCEPT listOfColumns] FROM ... not this: SELECT listOfColumns [EXCEPT (listOfColumns) [listOfColumns [EXCEPT (listOfColumns)]]]... FROM ... So there

Working around, or with, bitmap heap scan?

2018-10-31 Thread James A. Robinson
Hello, I'm newly exposed to a Postgres 9.4 database system, and am trying to understand how I might optimize a query that is taking a long time to return. What I'm observing is an uncached query that takes much much longer to complete, sometimes minutes longer, when enable_bitmapsc

Re: Copy data from DB2 (Linux) to PG

2018-11-01 Thread James A. Robinson
On Thu, Nov 1, 2018 at 10:28 AM Ravi Krishna wrote: > > I have a project to develop a script/tool to copy data from DB2 to PG. The > approach I am thinking is > > 1. Export data from db2 in a text file, with, say pipe as delimiter. > 2. Load the data from the text file to PG

Re: Copy data from DB2 (Linux) to PG

2018-11-01 Thread James A. Robinson
On Thu, Nov 1, 2018 at 10:50 AM Ravi Krishna wrote: > [...] What I need is a constant refresh. > We plan to use it daily to replicate data from db2 to pg. Perhaps you've already considered and discarded the idea, but your use case made me think back to when I was looking at AWS SCT

  1   2   >