Re: psql crash with custom build on RedHat 7
On Tue, Dec 19, 2023 at 7:58 PM Thomas Munro wrote: > On Wed, Dec 20, 2023 at 4:41 AM Dominique Devienne > wrote: > > On Tue, Dec 19, 2023 at 2:02 PM Thomas Munro > wrote: > >> On Wed, Dec 20, 2023 at 1:39 AM Dominique Devienne > wrote: > >> > Program received signal SIGSEGV, Segmentation fault. > >> > 0x004232b8 in slash_yylex () > > OK but be warned that if you're using tarballs, we shipped lexer remnants > in the tree > [...] which means that if your pipeline involves tarballs but you finished > up > regenerating one of the files, or some other sequence involving > different flex versions, you could get that. > Thanks. Very insightful. We got tarballs from https://www.postgresql.org/ftp/source/v16.1/, thus it could have been it indeed. We've rebuilt from scratch again, and now things are back to normal. I'm not 100% what fixed it exactly, since I get 2nd hand info only, and thus don't know for sure whether `make maintainer-clean` was used or not. Could also have been a glitch in our SCM, we also forced a resync on the workspace with 3rd parties (NFS mounted). I any case, this is now resolved, albeit in a muddy way I'm afraid... Really appreciate the help. Thanks, --DD
How to generate random bigint
Postgres's random() function generates a random double. That can be converted to a random int for smaller integers, but a double can't represent all of the values in a bigint. Is there a recommended way to generate a random bigint in Postgres? Thanks, Phillip
Re: How to generate random bigint
Phillip Diffley writes: > Postgres's random() function generates a random double. That can be > converted to a random int for smaller integers, but a double can't > represent all of the values in a bigint. Is there a recommended way to > generate a random bigint in Postgres? Doesn't look like there's anything directly exposed for that. Since PG v13 you could use gen_random_uuid, if you're careful to extract only bits that aren't fixed by the v4 UUID spec. pgcrypto's pg_random_bytes() function offers another some-assembly-required solution that'd work considerably further back. Or you could make a custom C function that leverages pg_strong_random(). regards, tom lane
Re: How to generate random bigint
On Thu, Dec 21, 2023 at 7:21 PM Tom Lane wrote: > Phillip Diffley writes: > > Postgres's random() function generates a random double. That can be > > converted to a random int for smaller integers, but a double can't > > represent all of the values in a bigint. Is there a recommended way to > > generate a random bigint in Postgres? > > Doesn't look like there's anything directly exposed for that. > Since PG v13 you could use gen_random_uuid, if you're careful > to extract only bits that aren't fixed by the v4 UUID spec. > pgcrypto's pg_random_bytes() function offers another > some-assembly-required solution that'd work considerably > further back. Or you could make a custom C function that > leverages pg_strong_random(). Also pg_read_binary_file('/dev/urandom', 0, 8) could be useful (assuming you're on Unix) if you can figure out how to cast it...