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 test

Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function

2018-07-09 Thread Andres Freund
Hi, On 2018-07-09 09:59:58 -0700, Peter Geoghegan wrote: > On Thu, Jun 28, 2018 at 8:02 AM, Andres Freund wrote: > > I believe this happens because there's currently no relcache > > invalidation registered for the main relation, until *after* the index > > is built. Normally it'd be the

Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function

2018-07-09 Thread Peter Geoghegan
On Mon, Jul 9, 2018 at 11:32 AM, Andres Freund wrote: >> Note that there is a kludge within plan_create_index_workers() that >> has us treat the heap relation as an inheritance parent, just to get a >> RelOptInfo for the heap relation without running into similar trouble >> with the index in

Re: How to watch for schema changes

2018-07-09 Thread Igor Korot
Hi, Adrian On Tue, Jul 3, 2018 at 1:24 PM, Adrian Klaver wrote: > On 07/03/2018 11:15 AM, Igor Korot wrote: >> >> Adrian, >> >> On Tue, Jul 3, 2018 at 12:32 PM, Adrian Klaver >> wrote: >>> >>> On 07/03/2018 10:21 AM, Igor Korot wrote: Hi, ALL, Is there any trigger or some

Re: How to watch for schema changes

2018-07-09 Thread David G. Johnston
On Mon, Jul 9, 2018 at 1:49 PM, Igor Korot wrote: > Just a thought... > Is it possible to create a trigger for a system table? > Not sure, and doesn't seem documented either way, but seems easy enough to try on a test cluster... ​[...]​ > Successful "CREATE TABLE..." statement creates a row

Re: Cloning schemas

2018-07-09 Thread Adrian Klaver
On 07/09/2018 03:23 PM, Adrian Klaver wrote: On 07/09/2018 02:50 PM, Melvin Davidson wrote: Adrian, The problem is that the relname/object has changed in the new schema. In this case from text_idx --> idx_test_id_idx. So this happens: test_(postgres)# comment on index sch_test.test_idx

Re: Cloning schemas

2018-07-09 Thread Adrian Klaver
On 07/09/2018 02:50 PM, Melvin Davidson wrote: Adrian, The code that CREATES the TABLE is EXECUTE 'CREATE TABLE ' || buffer || ' (LIKE ' || quote_ident(source_schema) || '.' || quote_ident(object)     || ' INCLUDING ALL)'; The schema names are supposed to be changed! This function HAS

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
Dias, As an experiment, I commented out the code that creates the comment on indexes and it still works flawlessly, so that part is redundant. I have attached the modified function below, Please retry and see if the problem still exists. If it does, then please do a schema only pg_dump of the

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
Adrian, The code that CREATES the TABLE is EXECUTE 'CREATE TABLE ' || buffer || ' (LIKE ' || quote_ident(source_schema) || '.' || quote_ident(object) || ' INCLUDING ALL)'; The schema names are supposed to be changed! This function HAS been tested and does WORK. Please do not muddle the

Re: Cloning schemas

2018-07-09 Thread DiasCosta
Hi Melvin, I followed your recommendation and it did not work. Since I was in a rush I did try to understand where the function crashed and commenting in the function the creation of comments for indexes, as follows, was sufficient for the function work.     IF FOUND   THEN --   

Re: Cloning schemas

2018-07-09 Thread Adrian Klaver
On 07/09/2018 09:49 AM, Melvin Davidson wrote: On Mon, Jul 9, 2018 at 12:32 PM, DiasCosta > wrote: Hi Melvin, Trying run 9.6 clone_schema on a different schema and I get the following error: NOTICE:  search path = {public,pg_catalog}

Reconnecting a slave to a newly-promoted master

2018-07-09 Thread Shawn Mulloney
I'm unclear on the prerequisites for what must be a very common scenario: There are three PostgreSQL machines: A, B, and C. B and C are slaves off of the master, A. A fails, and B is promoted to being the new master. Can C just be pointed at A and have it "just work"?

How to set array element to null value

2018-07-09 Thread Brahmam Eswar
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:=''; END IF; END LOOP; -- Thanks & Regards, Brahmeswara Rao J.

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:='';

Create event triger

2018-07-09 Thread Łukasz Jarych
Hi, 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? Like event trigger? It would be very helpful for

Re: Cloning schemas

2018-07-09 Thread Łukasz Jarych
Hi Melvin, i am trying to run postgresql 10 cloning schema function but still i am getting error... [image: image.png] Error: Error in syntax near "SYSTEM" Context: Function PL/pgSQL, row 212 in EXECUTE What is happening? Best, Jacek sob., 7 lip 2018 o 22:20 Melvin Davidson napisał(a): >

Re: How to set array element to null value

2018-07-09 Thread Pavel Stehule
2018-07-09 11:58 GMT+02:00 Brahmam Eswar : > 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:=''; > END

Create DDL trigger to catch which column was altered

2018-07-09 Thread Łukasz Jarych
Hi Guys, i am using sqls like below to track ddl changes: CREATE TABLE track_ddl > ( > event text, > command text, > ddl_time timestamptz, > usr text > ); > CREATE OR REPLACE FUNCTION track_ddl_function() > RETURNS event_trigger > AS > $$ > BEGIN > INSERT INTO track_ddl values(tg_tag,

Re: Cloning schemas

2018-07-09 Thread DiasCosta
Hi Melvin, Trying run 9.6 clone_schema on a different schema and I get the following error: NOTICE:  search path = {public,pg_catalog} CONTEXT:  PL/pgSQL function clone_schema(text,text,boolean) line 79 at RAISE ERROR:  relation "bilhetica_logic_schema.idx_unq_cod_operador_aml" does not

Re: How to set array element to null value

2018-07-09 Thread David Fetter
On Mon, Jul 09, 2018 at 03:28:45PM +0530, Brahmam Eswar wrote: > I'm trying to reset array element to null. You can do this in SQL as follows: SELECT ARRAY( SELECT CASE e WHEN 'ABC' THEN NULL ELSE e FROM UNNEST(x) _(e) ) This should really be going to pgsql-general because to is about

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
On Mon, Jul 9, 2018 at 5:14 AM, Łukasz Jarych wrote: > Hi Melvin, > > i am trying to run postgresql 10 cloning schema function but still i am > getting error... > > [image: image.png] > > Error: Error in syntax near "SYSTEM" > Context: Function PL/pgSQL, row 212 in EXECUTE > > What is happening?

Re: Cloning schemas

2018-07-09 Thread Melvin Davidson
On Mon, Jul 9, 2018 at 12:32 PM, DiasCosta wrote: > Hi Melvin, > > Trying run 9.6 clone_schema on a different schema and I get the following > error: > > NOTICE: search path = {public,pg_catalog} > CONTEXT: PL/pgSQL function clone_schema(text,text,boolean) line 79 at > RAISE > ERROR: relation

Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function

2018-07-09 Thread Peter Geoghegan
On Thu, Jun 28, 2018 at 8:02 AM, Andres Freund wrote: > Peter, looks like you might be involved specifically. Seems that way. > This however seems wrong. Cleary the relation's index list is out of > date. > > I believe this happens because there's currently no relcache > invalidation