Re: Missing WAL file after running pg_rewind

2018-01-14 Thread Michael Paquier
On Mon, Jan 15, 2018 at 12:13:46AM +, Dylan Luong wrote: > The content of the history file 0006.history is: Please do not top-post. This breaks the logic of the thread. > $ more 0006.history > 1 2CE/8A98no recovery target specified > 2 2CE/FF974EF0no recovery t

RE: Missing WAL file after running pg_rewind

2018-01-14 Thread Dylan Luong
The content of the history file 0006.history is: $ more 0006.history 1 2CE/8A98no recovery target specified 2 2CE/FF974EF0no recovery target specified 3 2CF/5198no recovery target specified 4 2D1/C90ACD88no recovery target specified 5 3

Re: psql format result as markdown tables

2018-01-14 Thread Vick Khera
How does this work for you? I use this to get tables to insert into my wiki, which are basically the format you want. I just delete the extra lines I don't want at the end. vk=> SELECT * FROM (values(1,2),(3,4)) as t; column1 | column2 -+- 1 | 2 3 | 4 (2

Re: String comparison problem in select - too many results

2018-01-14 Thread Peter J. Holzer
On 2018-01-14 13:20:05 +0100, Francisco Olarte wrote: > On Sun, Jan 14, 2018 at 12:14 PM, Peter J. Holzer wrote: > > On 2018-01-12 11:08:39 +0100, Francisco Olarte wrote: > >> C collation is like sorting raw bytes, it doesn't event sort > >> upper/lower case correctly > > > > Now you are falling i

Sv: Re: Is ORDER BY in sub-query preserved when outer query is only projection?

2018-01-14 Thread Andreas Joseph Krogh
På søndag 14. januar 2018 kl. 13:30:29, skrev Francisco Olarte < fola...@peoplecall.com >: Andreas: On Sun, Jan 14, 2018 at 1:03 PM, Andreas Joseph Krogh wrote: > SELECT q.* FROM ( >   SELECT comp.id, comp.name >   FROM company comp JOIN req r ON r.company_id =

Re: Is ORDER BY in sub-query preserved when outer query is only projection?

2018-01-14 Thread Francisco Olarte
Andreas: On Sun, Jan 14, 2018 at 1:03 PM, Andreas Joseph Krogh wrote: > SELECT q.* FROM ( > SELECT comp.id, comp.name > FROM company comp JOIN req r ON r.company_id = comp.id > ORDER BY LOWER(comp.name) ASC > ) AS q > ORDER BY r.status ASC > > What I'm trying to do here is to order by some

Re: String comparison problem in select - too many results

2018-01-14 Thread Francisco Olarte
On Sun, Jan 14, 2018 at 12:14 PM, Peter J. Holzer wrote: > On 2018-01-12 11:08:39 +0100, Francisco Olarte wrote: >> C collation is like sorting raw bytes, it doesn't event sort >> upper/lower case correctly > > Now you are falling into the same trap as Durumdara, calling an > unintended sort order

Is ORDER BY in sub-query preserved when outer query is only projection?

2018-01-14 Thread Andreas Joseph Krogh
Hi.   I have this query:   SELECT q.* FROM (   SELECT comp.id, comp.name   FROM company comp JOIN req r ON r.company_id = comp.id   ORDER BY LOWER(comp.name) ASC ) AS q ORDER BY r.status ASC   What I'm trying to do here is to order by some status (which may be only 1 of 3 values, for instance OPEN

Re: String comparison problem in select - too many results

2018-01-14 Thread Peter J. Holzer
On 2018-01-12 11:08:39 +0100, Francisco Olarte wrote: > C collation is like sorting raw bytes, it doesn't event sort > upper/lower case correctly Now you are falling into the same trap as Durumdara, calling an unintended sort order "not correct" ;-). C collation is certainly not what a "normal us

Re: Sv: Re: Sv: Re: Sv: Re: Sv: Re: data-checksums

2018-01-14 Thread Peter J. Holzer
On 2018-01-10 11:39:21 -0800, Andres Freund wrote: > On 2018-01-09 20:51:17 -0500, Stephen Frost wrote: > > * Andreas Joseph Krogh (andr...@visena.com) wrote: > > > Aha, so enabling CRC causes hint-bits to be written causing extra > > > WAL-logging, > > > which woudn't be the case without CRC ena

Re: Using random() in update produces same random value for all

2018-01-14 Thread Ken Tanzer
On Sun, Jan 14, 2018 at 2:01 AM, Alex Magnum wrote: > Hi, > i am trying to update a table with some random dates but that does not > seem to work. > > UPDATE table >SET last_update=now()::date-(SELECT (random() * 5)::INTEGER + 1) > > The updated field is always set to the same. Is there a way

Using random() in update produces same random value for all

2018-01-14 Thread Alex Magnum
Hi, i am trying to update a table with some random dates but that does not seem to work. UPDATE table SET last_update=now()::date-(SELECT (random() * 5)::INTEGER + 1) The updated field is always set to the same. Is there a way to make it random for every record? I could run it through a funct