Re: Bug in documentation (trim(...))?

2019-05-20 Thread Johann Spies
Thanks! I was a bit stupid. Johann On Mon, 20 May 2019 at 12:18, Francisco Olarte wrote: > On Mon, May 20, 2019 at 12:09 PM Johann Spies > wrote: > > The following illustrates the problem (removing double quotes from a > string): > > Missing "select " in y

Bug in documentation (trim(...))?

2019-05-20 Thread Johann Spies
The following illustrates the problem (removing double quotes from a string): *js=# select regexp_replace(regexp_replace( '"University of Cape Town"', '^"', ''),'"$', ''); regexp_replace - University of Cape Town(1 row)js=# trim(both '"' from '"University of C

Permission to refresh materialized view

2019-03-13 Thread Johann Spies
We did run this query: *GRANT ALL ON ALL TABLES IN SCHEMA X TO USER Y;* But user Y gets the message that he has to be the owner of a materialized view to be able to refresh it. Is that intended behaviour? Is there a way to enable the user to refresh materialized views in that schema? Regards J

Re: How to build a btree index with integer values on jsonb data?

2018-12-13 Thread Johann Spies
Thank you very much. It worked. Regards Johann On Thu, 13 Dec 2018 at 11:03, Andrew Gierth wrote: > > >>>>> "Johann" == Johann Spies writes: > > Johann> How can I transform the following definition to index pubyear > Johann> as integer and n

Re: How to build a btree index with integer values on jsonb data?

2018-12-13 Thread Johann Spies
On Thu, 6 Dec 2018 at 19:27, Laurenz Albe wrote: > > Replace > > COLLATE pg_catalog."default" > > with > > ::integer which results in syntax error at or near "::" LINE 2: ...'::text) -> 'pub_info'::text) ->> '@pubyear'::text)::integer moving the ::integer into the bracket also: syntax erro

How to build a btree index with integer values on jsonb data?

2018-12-06 Thread Johann Spies
How can I transform the following definition to index pubyear as integer and not text? CREATE INDEX pubyear_idx ON some_table_where_data_field_is_of_type_jsonb USING btree ((data -> 'REC'::text) -> 'static_data'::text) -> 'summary'::text) -> 'pub_info'::text) ->> '@pubyear'::text) COLL

Which background task looks for pg_xlog in 10?

2018-08-27 Thread Johann Spies
I see this in /var/log/postgresql/postgresql-10-main.log: postgres postgres@template1 ERROR: could not open directory "pg_xlog": No such file or directory postgres postgres@template1 STATEMENT: SELECT count(*) AS segments FROM pg_ls_dir('pg_xlog') t(fn) \ WHERE fn ~ '^[0-9A-Z]{24}$' Where does

Re: Using Lateral

2018-03-28 Thread Johann Spies
Thanks David and Paul, You have helped me a lot. Regards Johann. On 28 March 2018 at 20:49, David G. Johnston wrote: > On Tuesday, March 27, 2018, Johann Spies wrote: >> >> In the past I could use this in a query: >> >> SELECT >> DISTINCT ut, &g

Re: Using Lateral

2018-03-28 Thread Johann Spies
Thanks Paul. I was hesitant to post my full query. It is a long and complicated query. But here it is now: WITH p AS ( SELECT ARRAY [ ARRAY [ 't', 'http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord' ] ] AS ns), uts AS ( SELECT s.ut FROM wos

Using Lateral

2018-03-27 Thread Johann Spies
In the past I could use this in a query: SELECT DISTINCT ut, CASE WHEN xpath_exists ('//t:address_spec/t:country/text()', q.address_spec, p.ns) THEN unnest (xpath ('//t:address_spec/t:country/text()', q

Logical replication: duplicate key problem

2018-03-19 Thread Johann Spies
I have followed the following process: * pg_dump --schema-only on server 1 * restored that schema-only dump on server 2 * created a publication on server 1 including all the tables on server 1 * created a subscription on server 2 Server 2 does not get updated data for the schema involved from any