Re: Wal streaming

2025-11-25 Thread Andrew
by repmgr is on node 2. 4. My archive command is still configured to use barman-wal-archive despite having moved to a streaming replication method in barman. So my question is, can I disable the archive command now that I am using streaming? Regards Andrew Sent from my iPhone > On 25

Wal streaming

2025-11-25 Thread Andrew
? Regards Andrew Sent from my iPhone

ERROR: could not attach to dynamic shared area

2024-06-26 Thread Andrew Longwill
ry is mentioned each time, however this is a query we’ve been running in production for many years. The query plan for that query is good. AWS have advised that we try setting max_parallel_workers=0 and max_parallel_workers_per_gather=0. Can anyone advise on why we might be seeing this error suddenly? Many thanks Andrew

Re: Window function for get the last value to extend missing rows

2023-05-12 Thread Andrew Gierth
|3 7 | 10 | 7 | 10 8 | 7 | 8 |7 9 | | 8 |7 10 | | 8 |7 11 | | 8 |7 12 | 4 | 12 |4 (12 rows) This _really_ isn't efficient, though; you end up with typically three sorts of the data. For a one-off operation or for generating a materialized view it might be acceptable. -- Andrew (irc:RhodiumToad)

Re: Return rows in input array's order?

2023-05-10 Thread Andrew Gierth
>>>>> "Dominique" == Dominique Devienne writes: Dominique> Is it possible to maintain $1's order directly in SQL? >> This is the correct way: >> >> SELECT ... FROM unnest($1) WITH ORDINALITY AS u(id,ord) >> JOIN yourtable t ON t.id

Re: Return rows in input array's order?

2023-05-10 Thread Andrew Gierth
he output ordering without needing to do any sorting. (The planner knows that the output of WITH ORDINALITY function scans is automatically ordered by the ordinal column, so it will usually generate plans that take advantage of that.) The presence of "ORDER BY u.ord" ensures that the output order is correct regardless of plan choice. -- Andrew (irc:RhodiumToad)

Re: Check that numeric is zero

2023-05-06 Thread Andrew Gierth
der than pg14 there's also int64_to_numeric which can be called directly from C. Datum zero_num = DirectFunctionCall1(int4_numeric, Int32GetDatum(0)); (remember that this will be allocated in the current memory context; if you want to keep a copy long-term, you'd want to datumCopy it somewhere else.) -- Andrew (irc:RhodiumToad)

Re: "PANIC: could not open critical system index 2662" - twice

2023-05-05 Thread Andrew Gierth
R:  parameter "ignore_system_indexes" cannot be set after connection Evgeny> start sudo -u postgres psql -w -p 5434 -d "options='-P'" (make that -d "dbname=whatever options='-P'" if you need to specify some database name; or use PGOPTIONS="-P" in the environment.) -- Andrew (irc:RhodiumToad)

Re: PostgreSQL extension for processing Graph queries (Apache AGE)

2022-12-03 Thread Young Seung Andrew Ko
, 2022 at 12:37 AM Alvaro Herrera wrote: > On 2022-Nov-29, Young Seung Andrew Ko wrote: > > > Hello PostgreSQL users, > > > > https://github.com/apache/age > > Apache AGE is an Apache 2-licensed open source PostgreSQL extension for > > storing Graph data. > >

PostgreSQL extension for storing Graph data (Apache AGE)

2022-11-29 Thread Young Seung Andrew Ko
Hello PostgreSQL users, https://github.com/apache/age Apache AGE is an Apache 2-licensed open source PostgreSQL extension for storing Graph data. The current version of Apache AGE is to enable PostgreSQL users to use Neo4j's openCypher-based graph queries in unison with existing relational tables

PostgreSQL extension for processing Graph queries (Apache AGE)

2022-11-29 Thread Young Seung Andrew Ko
Hello PostgreSQL users, https://github.com/apache/age Apache AGE is an Apache 2-licensed open source PostgreSQL extension for storing Graph data. The current version of Apache AGE is to enable PostgreSQL users to use Neo4j's openCypher-based graph queries in unison with existing relational tables

Appending data locally to a logical replication subscriber

2022-05-30 Thread andrew cooke
Is there anything else I should be concerned about? Thanks, Andrew

How many max_replication_slots?

2022-04-26 Thread andrew cooke
r per table? We have 14 publishers and seem to need more than 100 slots. Is this reasonable, or does it indicate some underlying error? They all share the same schema with ~60 tables and the logical replication should generate the union of the publishers on the subscriber. Thanks, Andrew

Re: Logical subscription / publication lifetimes

2022-04-22 Thread andrew cooke
see how else it could be practically implemented, but just want to be sure I am understanding. The idea that there are two phases (copy existing data then replicate operations) is a big help. Thanks again, Andrew On Fri, Apr 22, 2022 at 09:13:15AM -0700, David G. Johnston wrote: > On Fri, Ap

Logical subscription / publication lifetimes

2022-04-22 Thread andrew cooke
inbetween, or is it back-filled? I am not finding the answers to these questions in the docs at https://www.postgresql.org/docs/current/logical-replication.html but maybe I am overlooking something. The link above does mention copying an existing table which may imply Ts? Thanks, Andrew

Repeated, never-ending deadlock

2022-04-19 Thread andrew cooke
nstead goes round in circles? An answer of "nope, it must be a bug in your code" is fine / expected. It's just one of those days... This is Postgres 14 with a fairly default config (except that logical replication is enabled). Thanks, Andrew 2022-04-19 19:55:54.482 UTC [28560] ERROR:

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-10 Thread Andrew Hardy
a2', 'TEST0001'); INSERT INTO public.hotel_bookingx (itinerary, "hotelName") VALUES('TEST0001', 'Crown2'); COMMIT TRANSACTION; On Wed, 9 Feb 2022 at 20:01, Andrew Hardy wrote: > Really appreciate the input thank you. > > I shall try to pro

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Andrew Hardy
error message and a minimum structure that will cause it to occur. Andrew On Wed, 9 Feb 2022, 19:26 David G. Johnston, wrote: > On Wed, Feb 9, 2022 at 11:12 AM Andrew Hardy > wrote: > >> Do I need some particular kind of settings on my transaction to be able >> to delete and

DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Andrew Hardy
nsert under the same original PK value in the same transaction, then delete the FORDELETE item just before committing or will I hit the same issue? Thanks, Andrew

Identified cause of potential pg_upgrade failure on Windows due to OS update adding partial block list of ports 50xxxx (could not connect to server)

2021-05-04 Thread Andrew Armstrong
d look to use different ports not in the Windows block list to prevent this issue. Kind regards, Andrew

Re: WAL-files is not removing authomaticaly

2021-03-17 Thread Andrew Anderson
Deleting replication slot on slave resolve the issue, now WAL-files removing automaticaly ! Thanks a lot for your answers ! ср, 17 мар. 2021 г. в 10:59, Andrew Anderson : > But maybe there is a way to fix this ? Rebuilding slave from master with > erasing ${PGDATA} on slave does not help.

Re: WAL-files is not removing authomaticaly

2021-03-17 Thread Andrew Anderson
But maybe there is a way to fix this ? Rebuilding slave from master with erasing ${PGDATA} on slave does not help. вт, 16 мар. 2021 г. в 16:56, Laurenz Albe : > On Tue, 2021-03-16 at 16:11 +0200, Andrew Anderson wrote: > > postgres=# show wal_keep_segments; > > wa

Re: WAL-files is not removing authomaticaly

2021-03-16 Thread Andrew Anderson
And will it fix the automated removing of WAL-files ? вт, 16 мар. 2021 г. в 19:39, Tom Lane : > Andrew Anderson writes: > >> What's using it? > > > As I think, streaming replication is using this slot. Does anybody know > how > > to fix it ? > > Unless you

Re: WAL-files is not removing authomaticaly

2021-03-16 Thread Andrew Anderson
You're right, restart_lsn on slave does not changes. > What's using it? As I think, streaming replication is using this slot. Does anybody know how to fix it ? вт, 16 мар. 2021 г. в 17:44, Tom Lane : > Andrew Anderson writes: > >> - replication slot (you said

Re: WAL-files is not removing authomaticaly

2021-03-16 Thread Andrew Anderson
ary_slot_name = 'stanby_slot' postgres=# show wal_keep_segments; wal_keep_segments --- 32 (1 row) but on slave: $ ls pg_wal/ | wc -l 1892 вт, 16 мар. 2021 г. в 15:53, Laurenz Albe : > On Tue, 2021-03-16 at 15:31 +0200, Andrew Anderson wrote: > > вт, 16 ма

Re: WAL-files is not removing authomaticaly

2021-03-16 Thread Andrew Anderson
-- 0002014500F6 (1 row) вт, 16 мар. 2021 г. в 14:21, Laurenz Albe : > On Tue, 2021-03-16 at 09:49 +0200, Andrew Anderson wrote: > > 2021-03-16 09:44:03.997 EET [97581] [] [] [] []DEBUG: attempting to > remove WAL segments older than log file 013E0097 > > That was the ent

Re: WAL-files is not removing authomaticaly

2021-03-16 Thread Andrew Anderson
parameter "log_checkpoints" removed from configuration file, reset to default 2021-03-16 09:44:19.937 EET [97585] [] [] [] []DEBUG: parameter "log_checkpoints" removed from configuration file, reset to default вт, 16 мар. 2021 г. в 09:40, Laurenz Albe : > On Tue, 2021-

Re: WAL-files is not removing authomaticaly

2021-03-16 Thread Andrew Anderson
.000 EET [97583] [] [] [] []DEBUG: writing stats file "pg_stat_tmp/db_13212.stat" 2021-03-16 06:32:21.000 EET [97583] [] [] [] []DEBUG: writing stats file "pg_stat_tmp/db_0.stat" 2021-03-16 06:32:21.013 EET [97575] [] [] [] []DEBUG: server process (PID 35775) exited with exi

Re: WAL-files is not removing authomaticaly

2021-03-11 Thread Andrew Anderson
| (1 row) But when I add new data to the table on master, it apears on slave. > Look for strange messages in the log file on both servers. Looking for strange messages gives nothing, in today's logs there is no any strange messages, just about connects of applications. Regards, Andrew

Can I use Postgres rules to reset session variables before/after queries?

2021-01-24 Thread Andrew Stuart
I am using Postgres row level security and I wish to ensure it is not possible for a specific session variable (that holds a tenant id) to remain set in between transactions / queries. The reason is because this is a web application that pools sessions and the session is shared between user web qu

Re: Listen/Notify feedback

2020-07-12 Thread Andrew Smith
On Sun, 12 Jul 2020 at 21:39, Rita wrote: > Thats good to know. Are there some standard patterns or best practices I > should follow when using messaging and with listen/notify? > > On Sat, Jul 11, 2020 at 1:44 PM Brian Dunavant wrote: > >> One aspect is if there is no one listening when a notif

Re: Compiling C Extension Functions against PostgreSQL 12

2020-05-03 Thread Andrew Gierth
ing clang (as well as gcc if that's what was used to build PG itself), and there's clearly some disagreement going on between clang and your system header files that's causing the failure. I didn't see an easy way of disabling bitcode emission for a module, though I think that has been discussed before. -- Andrew (irc:RhodiumToad)

Re: \COPY to accept non UTF-8 chars in CHAR columns

2020-03-28 Thread Andrew Gierth
once the data is imported, fix it up by adjusting how the data is split and regenerating the correct sequence (assuming your application allows this). For example you could encode an arbitrary byte xy as a sequence of two codepoints U+FDDx U+FDEy (the range FDD0-FDEF are all defined as noncharacters). -- Andrew (irc:RhodiumToad)

Re: \COPY to accept non UTF-8 chars in CHAR columns

2020-03-27 Thread Andrew Gierth
Any such input will end up double-encoded, requiring further work to fix. -- Andrew (irc:RhodiumToad)

Re: \COPY to accept non UTF-8 chars in CHAR columns

2020-03-27 Thread Andrew Gierth
; use bytes; sub c { decode("UTF-8",shift,sub { decode("windows-1252", chr(shift)) }); } s/([\x80-\xFF]+)/encode("UTF-8",c($1))/eg' outfile -- Andrew (irc:RhodiumToad)

Re: Real application clustering in postgres.

2020-03-06 Thread Andrew Kerber
#x27;t the filesystem (or RDBMS) throwing checksum errors? This was > standard stuff in legacy Enterprise RDBMSs 20 years ago. > > -- > Angular momentum makes the world go 'round. > > > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: jsonb_set() strictness considered harmful to data

2020-01-07 Thread Andrew Dunstan
On Wed, Jan 8, 2020 at 7:08 AM Pavel Stehule wrote: > > Hi > > po 6. 1. 2020 v 22:34 odesílatel Andrew Dunstan > napsal: >> >> >> Updated version including docco and better error message. >> >> cheers >> >> andrew > > > I think s

Re: jsonb_set() strictness considered harmful to data

2020-01-06 Thread Andrew Dunstan
On Thu, Nov 28, 2019 at 2:15 PM Andrew Dunstan wrote: > > > On 11/27/19 9:35 PM, Michael Paquier wrote: > > On Fri, Nov 15, 2019 at 09:45:59PM +0100, Pavel Stehule wrote: > >> Maybe ERRCODE_NULL_VALUE_NOT_ALLOWED, and "NULL is not allowed", > &

Re: When should parameters be passed as text v. binary?

2020-01-04 Thread Andrew Gierth
e formats, and if you start using extension types then not all of them even _have_ a binary format. And to decode a binary result you need to know the type, and have code to handle every specific type's binary format. -- Andrew (irc:RhodiumToad)

Re: Are PostgreSQL functions that return sets or tables evaluated lazily or eagerly?

2020-01-03 Thread Andrew Gierth
documentation or source code may indicate whether the language uses materialize mode or value-per-call mode. (Most languages are probably not well equipped to do value-per-call mode. One that does allow it is pl/lua, which runs table functions as coroutines.) -- Andrew (irc:RhodiumToad)

Re: Max locks

2019-12-19 Thread Andrew Gierth
ually report an error until shared memory is actually exhausted, and it's possible that there may be unused space. (Performance may degrade if there are more locks than the configured maximum, because the hash table will have been sized for that maximum and can't be grown.) See comments for ShmemInitHash. -- Andrew (irc:RhodiumToad)

Re: Encoding/collation question

2019-12-11 Thread Andrew Gierth
on specific columns or in individual queries. -- Andrew (irc:RhodiumToad)

Re: jsonb_set() strictness considered harmful to data

2019-11-27 Thread Andrew Dunstan
exception >> and maybe some errhint - "Maybe you would to use Jsonb NULL - "null"::jsonb" >> >> I don't know, but in this case, the exception should be verbose. This is >> "rich" function with lot of functionality > @Andrew: This p

Re: Remote Connection Help

2019-11-21 Thread Andrew Kerber
>> Yes "listen_addresses" is not commented. I did notice when I did the > > netstat, for tcp, it was all "127.0.0.1" on various ports including > > 5432 but I have a listing for tcp6 that has my static IP using port > > 32305. Would that make a difference? > > > > Hm, well, *something* is overriding the setting. What did you find in > > pg_settings? > > > > regards, tom lane > > > > > > > > > > > -- > Adrian Klaver > [email protected] > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: Remote Connection Help

2019-11-21 Thread Andrew Kerber
uld > that > make a difference? > > Hm, well, *something* is overriding the setting. What did you find in > pg_settings? > > regards, tom lane > > > > > > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: ***SPAM*** Re: [SPAM] Remote Connection Help

2019-11-21 Thread Andrew Kerber
t? > > And, just as a side note, I normally don't activate IPv6 if it's not > necessary (it has not been necessary in the last 10 years :-) ), 'cause > I've run in some troubles that have been cleared getting rid of IPv6) > so I'll try editing postgresql.conf as > listen = '127.0.0.1' > > HTH, > Moreno.- > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: here does postgres take its timezone information from?

2019-11-17 Thread Andrew Gierth
>>>>> "Tom" == Tom Lane writes: Tom> Andrew Gierth writes: Tom> I think the "official" name of that zone is America/Los_Angeles. Tom> But initdb might seize on the US/Pacific alias, if available, >> And now you know why I have been sayin

Re: here does postgres take its timezone information from?

2019-11-17 Thread Andrew Gierth
case, an update >> note might be sufficient? Tom> I think the "official" name of that zone is America/Los_Angeles. Tom> But initdb might seize on the US/Pacific alias, if available, And now you know why I have been saying for so many years that initdb should use the official names! -- Andrew (irc:RhodiumToad)

Re: jsonb_set() strictness considered harmful to data

2019-11-15 Thread Andrew Dunstan
Any other looks well, and this function can be very handy. > > Thanks for the review. I will add some docco. What would be a better error message? "null jsonb replacement not permitted"? cheers andrew -- Andrew Dunstanhttps://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: CASE(?) to write in a different column based on a string pattern

2019-11-13 Thread Andrew Kerber
ttern, 4) ELSE '' END AS bar > CASE WHEN pattern LIKE 'baz%' THEN SUBSTR(pattern, 4) ELSE '' END AS baz > FROM tbl; > > Geoff > > > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: jsonb_set() strictness considered harmful to data

2019-10-28 Thread Andrew Dunstan
On 10/21/19 9:28 AM, Andrew Dunstan wrote: > On 10/21/19 2:07 AM, Tomas Vondra wrote: >> On Sun, Oct 20, 2019 at 06:51:05PM -0400, Andrew Dunstan wrote: >>>> I think the general premise of this thread is that the application >>>> developer does not realize that

Re: jsonb_set() strictness considered harmful to data

2019-10-21 Thread Andrew Dunstan
On 10/21/19 2:07 AM, Tomas Vondra wrote: > On Sun, Oct 20, 2019 at 06:51:05PM -0400, Andrew Dunstan wrote: >> >>> I think the general premise of this thread is that the application >>> developer does not realize that may be necessary, because it's a bit >>&g

Re: jsonb_set() strictness considered harmful to data

2019-10-20 Thread Andrew Dunstan
On 10/20/19 4:18 PM, Tomas Vondra wrote: > On Sun, Oct 20, 2019 at 03:48:05PM -0400, Andrew Dunstan wrote: >> >> On 10/20/19 1:14 PM, David G. Johnston wrote: >>> On Sun, Oct 20, 2019 at 5:31 AM Andrew Dunstan >>> >> <mailto:[email protected]

Re: jsonb_set() strictness considered harmful to data

2019-10-20 Thread Andrew Dunstan
On 10/20/19 1:14 PM, David G. Johnston wrote: > On Sun, Oct 20, 2019 at 5:31 AM Andrew Dunstan > <mailto:[email protected]>> wrote: > > And yet another is to > raise an exception, which is easy to write but really punts the issue > back to the

Re: jsonb_set() strictness considered harmful to data

2019-10-20 Thread Andrew Dunstan
meter. Possibly we could even add an extra parameter to specify what should be done. Also, the question will arise what to do when any of the other parameters are NULL. Should we return NULL in those cases as we do now? cheers andrew -- Andrew Dunstanhttps://www.2ndQuadrant.

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Andrew Dunstan
able argument in the first > place, and can reasonably safely and effectively prevent it going > forward.  Then people will have to explicitly code what they want to > do if their data and queries present this invalid unknown data to the > function. > > How exactly do we prevent a NULL being passed as an argument? The only thing we could do would be to raise an exception, I think. That seems like a fairly ugly thing to do, I'd need a h3eck of a lot of convincing. cheers andrew -- Andrew Dunstanhttps://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Andrew Dunstan
On 10/19/19 12:18 PM, Tomas Vondra wrote: > On Sat, Oct 19, 2019 at 11:26:50AM -0400, Andrew Dunstan wrote: > > Not sure, but that seems rather confusing to me, because it's mixing SQL > NULL and JSON null, i.e. it's not clear to me why > >    jsonb_set(..., ".

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Andrew Dunstan
hat policy that is in large measure responsible for Postgres' deserved reputation for stability. Incidentally, why is your function written in plpgsql? Wouldn't a simple SQL wrapper be better? create or replace function safe_jsonb_set     (target jsonb, path text[], new_value jsonb, create_missing boolean default true) returns jsonb as $func$     select case when new_value is null then target else jsonb_set(target, path, new_value, create_missing) end $func$ language sql; And if we were to change it I'm not at all sure that we should do it the way that's suggested here, which strikes me as no more intuitive than the current behaviour. Rather I think we should possibly fill in a json null in the indicated place. cheers andrew -- Andrew Dunstanhttps://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: drop database

2019-10-17 Thread Andrew Kerber
also easy to change tactics if the need arises. > >> -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: Inserting multiple rows wtih a SELECt in the values clause

2019-10-15 Thread Andrew Gierth
ear in the top-level statement. What you want is: INSERT INTO rate(employee_key, project_key, work_type_key, rate) SELECT employee.employee_key, project.project_key, work_type.work_type_key, 1 as rate FROM employee CROSS JOIN project CROSS JOIN work_type; -- Andrew (irc:RhodiumToad)

Re: SELECT d02name::bytea FROM ... && DBI::Pg

2019-10-12 Thread Andrew Gierth
ince the actual meaning of SQL_ASCII is "no conversions"). For readability, you may then want to wrap that as encode(convert_to(d02name,'SQL_ASCII'),'escape') which will keep the ASCII characters but use \nnn escapes for non-ascii. -- Andrew (irc:RhodiumToad)

Re: day interval

2019-10-12 Thread Andrew Gierth
astcontext, castmethod from pg_cast c join pg_type t on (casttarget=t.oid) where typname='date'; select oprresult::regtype from pg_operator join pg_type t1 on (t1.oid=oprleft) join pg_type t2 on (t2.oid=oprright) where oprname='-' and t1.typname='date' and t2.typname='date'; -- Andrew (irc:RhodiumToad)

Re: day interval

2019-10-12 Thread Andrew Gierth
e problem: Abraham> How to recreate the problem. (You know - QA). Abraham> Tried changing lc_time, timezone and datestyle .. but nothing Abraham> seems to work None of these things can affect data types. -- Andrew (irc:RhodiumToad)

Re: day interval

2019-10-12 Thread Andrew Gierth
aham> day' - a string No, it'll always return an integer. You will only get an interval result if you subtract timestamps rather than dates, for example if one of the operands is actually an expression returning a timestamp. Give an example of an actual expression you used that re

Re: JSON vs. JSONB storage size

2019-10-11 Thread Andrew Gierth
ows is doing, but on my system (freebsd amd64) I get 136 rows/page vs. 120 rows/page, which would make a million rows take 57MB or 65MB. (Your use of pg_total_relation_size is including the pkey index, which confuses the results a bit.) -- Andrew (irc:RhodiumToad)

Re: Arrays and ANY problem

2019-09-30 Thread Andrew Gierth
the result as a single array rather than as rows, or use string_agg(name, ',' order by ord) if you want a comma-separated string result) regexp_split_to_table might be a better method than unnest/string_to_array. -- Andrew (irc:RhodiumToad)

Re: Possible bug: SQL function parameter in window frame definition

2019-09-29 Thread Andrew Gierth
n HEAD I'd be inclined to add assertions about utilityStmt Tom> being NULL. Yup. -- Andrew (irc:RhodiumToad)

Re: Possible bug: SQL function parameter in window frame definition

2019-09-29 Thread Andrew Gierth
>>>>> "Andrew" == Andrew Gierth writes: Andrew> We could minimize the chance of breakage in a back-patched fix Andrew> by having query_tree_walker/mutator iterate the windowClause Andrew> list itself Here is a draft patch along those lines; the intent of t

Re: Possible bug: SQL function parameter in window frame definition

2019-09-28 Thread Andrew Gierth
sions as the "default" case and tries to explicitly handle all non-expression nodes. -- Andrew (irc:RhodiumToad)

Re: Possible bug: SQL function parameter in window frame definition

2019-09-28 Thread Andrew Gierth
nk the logic that query_tree_walker is specifically there to walk places that might contain _expressions_ is reasonably valid. That said, the fact that we do have one caller that finds it necessary to explicitly walk some of the places that query_tree_walker omits suggests that this decision may ha

Re: Possible bug: SQL function parameter in window frame definition

2019-09-28 Thread Andrew Gierth
function inlining (the select f(3); is not inlined and therefore works, but the select * from f(3); is being inlined, but the original Param is somehow making it into the final plan rather than being substituted with its value). Looking into why. -- Andrew (irc:RhodiumToad)

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Andrew Gierth
ver timezone; there's no way (other than the same function set_config trick I gave above) to make it return a value that represents a different timezone per row. -- Andrew (irc:RhodiumToad)

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Andrew Gierth
terval language sql immutable as $$ select (t at time zone zone) - (t at time zone 'GMT'); $$; but formatting the interval result as text is a little more challenging due to needing explicit + signs: create function getOffsetStr(t timestamptz, zone text) returns text language

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-23 Thread Andrew Gierth
s, and in any event wouldn't solve this particular issue. -- Andrew (irc:RhodiumToad)

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-23 Thread Andrew Gierth
ts_to_char(t timestamptz, z text) returns text language plpgsql immutable set timezone = 'GMT' as $$ begin perform set_config('timezone', z, true); return t::text; end; $$; select ts_to_char(timestamptz '2020-04-04 16:00:00+00', 'Australia/Sydney'); ts_to_char 2020-04-05 02:00:00+10 -- Andrew (irc:RhodiumToad)

Re: Use of ?get diagnostics'?

2019-09-21 Thread Andrew Gierth
| ' row.'; should be V_ROW_COUNT, I suspect. Likewise line 46. (The CONTEXT lines of the error message would have identified the offending line of the function for you.) -- Andrew (irc:RhodiumToad)

Re: Recomended front ends?

2019-08-08 Thread Andrew Kerber
t; information. If you are not the named addressee you must not use or > disclose such information, instead please report it to [email protected] > <mailto:[email protected]> > Legal: Minerva Analytics is the trading name of: Minerva Analytics Ltd: > Registered in England Number 11260966 &am

Re: SCRAM-SHA-256, is it possible to retrieve enough information from PG server (pg_authid etc) to perform authentication as a client

2019-08-02 Thread Andrew Gierth
age attack on H(key_c). The right way to allow a privileged user to operate as if they were someone else is to use SET ROLE or SET SESSION AUTHORIZATION rather than actually trying to log in as the other user. -- Andrew (irc:RhodiumToad)

PGPOOL Question

2019-07-08 Thread Andrew Kerber
;ALLOW_TO_FAILOVER' master_slave_mode = on master_slave_sub_mode = 'stream' health_check_period = 10 health_check_timeout = 5 health_check_user = 'nobody' health_check_password = '' health_check_max_retries = 0 health_check_retry_delay = 1 connect_timeout = 1 failover_command = '' failback_command = '' -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: Measuring the Query Optimizer Effect: Turning off the QO?

2019-07-08 Thread Andrew Gierth
e it as FROM a JOIN b ON ... JOIN c ON ... For an example, try: explain select * from onek o1, tenk1 t, onek o2 where o1.unique1=t.unique1 and t.unique1=o2.unique1 and o1.unique2<10 and o2.unique2<10; which (at least for me) joins o1 and o2 together first even with the collapse limits set to 1. -- Andrew (irc:RhodiumToad)

Re: Measuring the Query Optimizer Effect: Turning off the QO?

2019-07-08 Thread Andrew Gierth
ch takes the (rewritten) query as input and converts it to something that the executor can take action on. There isn't actually any separate "optimization" phase. -- Andrew (irc:RhodiumToad)

Re:

2019-07-02 Thread Andrew Kerber
0679 > 4939355,12,2015-01-05,,2015-01-05 05:51:47,,,5000128639345 > 4939744,12,2015-01-05,,2015-01-05 05:51:47,,,5000128684510 > 4939750,12,2015-01-05,,2015-01-05 05:51:47,,,5000128683100 > 4936360,12,2015-01-05,,2015-01-05 05:51:47,,,5000128567527 > 4940308,12,2015-01-05,,2015-01-05 05:51:47,,,5000128781329 > 4938006,12,2015-01-05,,2015-01-05 05:51:47,,,4000128912554 > 4937457,12,2015-01-05,,2015-01-05 05:51:47,,,5000128426574 > > > > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'

Re: Argument casting hierarchy?

2019-07-01 Thread Andrew Gierth
timestamptz (as the preferred type) where timestamp without tz was intended or semantically required. -- Andrew (irc:RhodiumToad)

Re: "Time of latest checkpoint" stays too old on both master and slave

2019-06-30 Thread Andrew Gierth
en this kind of thing with FreeBSD where the kernel timecounter source has been chosen badly (i.e. choosing TSC when the TSC isn't actually invariant enough). Forcing TSC not to be used fixes it. The configuration I've especially noticed it on is when running in a VM with a single virtual CPU. -- Andrew (irc:RhodiumToad)

Re: [EXT EMAIL] Re: First Time Starting Up PostgreSQL and Having Problems

2019-06-19 Thread Andrew Gierth
>>>>> "Rob" == Rob Sargent writes: >>> local all all trust Rob> That line has four values and the header has 5. That's standard for "local" lines, which lack an ADDRESS field. -- Andrew (irc:RhodiumToad)

Re: found xmin * from before relfrozenxid *

2019-06-12 Thread Andrew Gierth
(this file is safe to remove since it is just a cache, and will be regenerated). Then update to 10.8. -- Andrew (irc:RhodiumToad)

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
ter '|'; Enter data to be copied followed by a newline. End with a backslash and a period on a line by itself, or an EOF signal. >> 0|1| cat $1 \| lpr -Pprinter |3|4 >> \. COPY 1 -- Andrew (irc:RhodiumToad)

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
WITH DELIMITER '|' (i.e. text mode, not CSV mode) then the \| is accepted as being a literal | and the unescaped | is treated as a delimiter. What is the point of the substitutions? -- Andrew (irc:RhodiumToad)

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
PY in mode TEXT and modify the data Matthias> before with: Matthias> sed 's/|/\v/g' < table-from-Sybase | sed 's/\\\v/|/g' > table-for-copy What on earth is this supposed to achieve? -- Andrew (irc:RhodiumToad)

Re: Research on ?? operators

2019-06-04 Thread Andrew Gierth
d Matteo> require funny escaping like ""? I don't recall seeing a ?? operator in the wild, but it is a perfectly legal operator name and you should assume that it exists somewhere. -- Andrew (irc:RhodiumToad)

Re: Two small questions re/ COPY CSV data into table

2019-06-04 Thread Andrew Gierth
kslash-sequences or escapes outside of quoted fields, quote characters inside quoted fields are doubled (though there's an option to change this). PG follows the CSV spec at https://www.ietf.org/rfc/rfc4180.txt fairly closely. -- Andrew (irc:RhodiumToad)

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Andrew Gierth
t use the shared_buffers but is buffered only in backend-local memory. This means that other processes (like, say, an autovacuum process) can not access the content of temp tables. So what you want is not possible. -- Andrew (irc:RhodiumToad)

Re: Strange performance degregation in sql function (PG11.1)

2019-05-18 Thread Andrew Gierth
d EXECUTE USING rather than interpolating the parameters into the query string). I suggest looking into the inlining question first. -- Andrew (irc:RhodiumToad)

Re: Back Slash \ issue

2019-05-03 Thread Andrew Gierth
e escaped as \\, and that any literal appearance of the delimiter character or a newline is also escaped. See https://www.postgresql.org/docs/current/sql-copy.html under "Text format". -- Andrew (irc:RhodiumToad)

Re: ERROR: operator does not exist: timestamp without time zone + integer

2019-04-30 Thread Andrew Gierth
', Adrian> LOCALTIMESTAMP)+7, Right, but since all these are exactly equivalent: CURRENT_DATE LOCALTIMESTAMP::date date_trunc('day',LOCALTIMESTAMP)::date and since date can be cast to timestamp, then DEFAULT current_date+7 would seem to be the simplest answer. -- Andrew (irc:RhodiumToad)

Re: ERROR: operator does not exist: timestamp without time zone + integer

2019-04-30 Thread Andrew Gierth
>>>>> "Adrian" == Adrian Klaver writes: Adrian> Or cast to a date: Adrian> test=> select date_trunc('day', localtimestamp)::date + 7; yeesh. that's a very long-winded way to write current_date + 7 -- Andrew (irc:RhodiumToad)

Re: Missing pg_config on SuSE SLES 12 for PostgreSQL 10

2019-04-27 Thread Andrew Gierth
>>>>> "Matthias" == Matthias Apitz writes: Matthias> There is no cmd 'pg_config'. Can I compile this from source? Some distros separate out a 'libpq' package, and have a 'libpq-devel' package with pg_config in it. Did you look for that? -- Andrew (irc:RhodiumToad)

Re: Computed index on transformation of jsonb key set

2019-04-27 Thread Andrew Gierth
apData)::uuid); end; $$; create index on tbl using gin (uuid_keys(mapData)); select * from tbl where uuid_keys(mapData) && array[...]; -- Andrew (irc:RhodiumToad)

Re: Postgres comparison bugfixes between arbitrary versions

2019-04-05 Thread Andrew Gierth
the older version Thomas> of the two. why-upgrade.depesz.com -- Andrew (irc:RhodiumToad)

Re: Subquery to select max(date) value

2019-03-28 Thread Andrew Gierth
That query seems correct assuming you want the result in descending order of next_contact. How did the actual result differ from your expectation? -- Andrew (irc:RhodiumToad)

  1   2   >