Would a BGW need shmem_access or database_connection to enumerate databases?

2017-11-29 Thread Chapman Flack
I'm thinking of writing a background worker that will enumerate the databases present, and spin off, for each one, another BGW that will establish a connection and do stuff. For the "master" one, what capabilities will it need to simply enumerate the current names of known databases? I suppose I

Re: Would a BGW need shmem_access or database_connection to enumerate databases?

2017-11-29 Thread Chapman Flack
On 11/29/2017 05:54 PM, Michael Paquier wrote: > Yes. That's actually what the autovacuum launcher does. It connects > using InitPostgres(NULL, InvalidOid, NULL, NULL), and then scans > pg_database to fetch a list (see get_database_list). Thanks! It looks like if get_database_list were not

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Chapman Flack
On 12/12/2017 12:00 PM, Geoff Winkless wrote: > I quite like this idea, although I would rather a line printed after > each command is run: something like > > mydbname=# select ; > -- > (1 row) > > \h for help, \q for quit, \expert to turn off this message > osprey=# It seems to me that this

Re: Would a BGW need shmem_access or database_connection to enumerate databases?

2017-12-14 Thread Chapman Flack
On 12/04/2017 09:13 AM, Craig Ringer wrote: > On 1 December 2017 at 23:04, Chapman Flack <c...@anastigmatix.net> wrote: >> Can I call RegisterDynamicBackgroundWorker when not in the postmaster, >> but also not in a "regular backend", but rather another BGW? >

worker_spi example BGW code GUC tweak

2017-12-14 Thread Chapman Flack
rom: Chapman Flack <c...@anastigmatix.net> Date: Thu, 14 Dec 2017 17:24:46 -0500 Subject: [PATCH] Give worker_spi.naptime an explicit time unit. --- src/test/modules/worker_spi/worker_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/modules/worker_spi/worker_sp

Re: worker_spi example BGW code GUC tweak

2017-12-17 Thread Chapman Flack
On 12/17/2017 07:32 PM, Robert Haas wrote: > Making it use GUC_UNIT_S seems like a good idea to me, but removing > the mention of seconds from the description doesn't seem like a good > idea to me. I took for my model a quick survey of existing GUCs that use GUC_UNIT_(MS|S|MIN) - most of which

Re: proposal: alternative psql commands quit and exit

2017-12-12 Thread Chapman Flack
On 12/12/2017 03:39 PM, Robert Haas wrote: > On Tue, Dec 12, 2017 at 10:02 AM, Geoff Winkless >> Ctrl-D works almost everywhere. It takes 2 seconds... > > If it really took everyone 2 seconds, this question would not be as > common as it is. ... Some years ago, I took a

Re: [HACKERS] Custom compression methods

2017-12-12 Thread Chapman Flack
On 12/12/2017 04:33 PM, Robert Haas wrote: > you want to upgrade your existing tables to use lz4 rather than pglz, > you can change the compression option for those columns to COMPRESS > lz4 PRESERVE pglz if you want to do it incrementally or just COMPRESS This is a thread I've only been

Does XMLSERIALIZE output xmlattributes in a stable order?

2017-11-21 Thread Chapman Flack
Suppose I have a query that generates some XML content, and I want to do this on a periodic schedule and check the resulting XML into a version control system. To avoid spurious diffs, I know I can control the order of child elements generated by xmlagg by slipping an ORDER BY into the aggregate

Re: Does XMLSERIALIZE output xmlattributes in a stable order?

2017-11-21 Thread Chapman Flack
On 11/21/2017 11:49 AM, Tom Lane wrote: > AFAICS, XMLSERIALIZE in our current implementation boils down to > being a binary-compatible coercion from XML (which is stored as > a string) to text. So the interesting question here is where are > you getting the XML values from? The stability of the

Re: Would a BGW need shmem_access or database_connection to enumerate databases?

2017-12-01 Thread Chapman Flack
On 11/29/2017 05:48 PM, Chapman Flack wrote: > I'm thinking of writing a background worker that will enumerate > the databases present, and spin off, for each one, another BGW > that will establish a connection and do stuff. Can I even do this? "Unlike RegisterBackgroundWorker,

Re: Logical replication without a Primary Key

2017-12-07 Thread Chapman Flack
On 12/07/2017 02:38 PM, Joshua D. Drake wrote: > A    B   C > foo,bar,baz > foo,bar,baz > > And then I say: > > UPDATE test set A = 1 where C = baz > > I have updated two rows because there is no primary key to identify the > differences. Both of those rows should be updated and thus

Re: Signals in a BGW

2017-12-07 Thread Chapman Flack
On 12/07/2017 02:58 PM, Andres Freund wrote: > On 2017-12-07 12:35:07 -0500, Robert Haas wrote: >> On Wed, Dec 6, 2017 at 6:59 PM, Chapman Flack <c...@anastigmatix.net> wrote: >>>> The default handler is bgworker_die ; see src/backend/postmaster >>>>

Re: proposal: alternative psql commands quit and exit

2017-12-11 Thread Chapman Flack
On 12/11/2017 04:16 PM, Tom Lane wrote: > Peter Eisentraut writes: >> No opinion on that, but if the problem is that people don't know how to >> quit psql, then we should just put that information back into the >> welcome message and be done with it. > > I don't

Re: pow support for pgbench

2017-12-06 Thread Chapman Flack
Raúl Marín Rodríguez wrote: > I don't want to go too deep into it, but you get stuff like this: > > Select pow(2.0, -3)::text = pow(2, -3)::text; > ?column? > -- > f Indeed, to me, that has turned out to be the most intriguing part of the whole thread.

That mode-700 check on DATADIR again

2017-12-11 Thread Chapman Flack
I have, more or less, this classic question: https://www.postgresql.org/message-id/4667C403.1070807%40t3go.de But I have it for a newer reason, where again it seems as if a better answer than "don't do that" might be worth having. 1. Suppose you are running PG in a VM (named pgvm just for

Signals in a BGW

2017-12-04 Thread Chapman Flack
I'm curious about handling signals in a background worker. As I understand it, these are blocked when the BGW is born, until enabled with BackgroundWorkerUnblockSignals() after possible customization. Is there a known, default behavior that some signals will have, if I simply

SPI/backend equivalent of extended-query Describe(statement)?

2018-05-13 Thread Chapman Flack
The longer version of $subject is: how would one go about, in the backend using SPI (or SPI and maybe other server APIs as needed), obtaining the same inferred parameter information that a front-end client can get with the Describe (statement variant) extended-query message? I ask because I've

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-14 Thread Chapman Flack
On 05/14/18 11:29, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> The longer version of $subject is: how would one go about, in the >> backend using SPI (or SPI and maybe other server APIs as needed), >> obtaining the same inferred parameter i

Re: Add read-only param to set_config(...) / SET that effects (at least) customized runtime options

2018-04-27 Thread Chapman Flack
On 04/20/2018 04:18 PM, Chapman Flack wrote: > On 04/20/2018 04:03 PM, Andrew Gierth wrote: >> Assign hooks aren't allowed to throw errors under any circumstance >> because they're called during transaction abort, and throwing an error >> during abort is obviously not tolera

Re: Postgres 11 release notes

2018-05-11 Thread Chapman Flack
On 05/11/2018 11:08 AM, Bruce Momjian wrote: > http://momjian.us/pgsql_docs/release-11.html > > I expect a torrent of feedback. ;-) Very superficial things: Add predicate locking for Hash, GiST, and GIN indexes s/likelyhood/likelihood/ Add extension jsonb_plpython There are two

Re: MAP syntax for arrays

2018-05-08 Thread Chapman Flack
On 05/08/2018 08:57 AM, Ildar Musin wrote: > > select map (pow(2, x) - 1 for x in array[1,2,3,4,5]); I wonder how efficient an implementation would be possible strictly as a function, without grammar changes? While PostgreSQL certainly has extensions to and divergences from standard SQL syntax,

Re: MAP syntax for arrays

2018-05-08 Thread Chapman Flack
On 05/08/2018 09:19 AM, Chapman Flack wrote: > > While PostgreSQL certainly has extensions to and divergences from > standard SQL syntax, some historical and some recent, it seems like > there ought to be a highish bar for adding new ones; or, looking at it > another way, has th

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-24 Thread Chapman Flack
On 05/14/18 13:46, Chapman Flack wrote: > On 05/14/18 11:29, Tom Lane wrote: >> Chapman Flack <c...@anastigmatix.net> writes: >>> The longer version of $subject is: how would one go about, in the >>> backend using SPI (or SPI and maybe other server APIs as needed)

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-25 Thread Chapman Flack
On 05/24/2018 02:30 AM, Chapman Flack wrote: > In 9.0, there's SPI_prepare_params, which seems promising; it accepts > an arbitrary ParserSetupHook "to control the parsing of external parameter > references." But its documentation doesn't suggest what to use as the > ParserSe

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-25 Thread Chapman Flack
On 05/25/2018 06:01 PM, Tom Lane wrote: > Offhand I don't believe SPI exposed a way to do that before 9bedd128d. > Does it matter? Pre-9.0 releases are long out of support by now, > which means they're full of known data-loss hazards and security bugs. Well, my exploration arose from

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-25 Thread Chapman Flack
On 05/25/18 20:07, Andrew Gierth wrote: > >> with writing a ParserSetupHook that's just a thin wrapper around > >> parse_variable_parameters ? > > That's what I did in pllua-ng. The tricky bit was in arranging to also > call check_variable_parameters; I considered skipping that part, but > that

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-25 Thread Chapman Flack
On 05/25/18 21:16, Andrew Gierth wrote: >> "Tom" == Tom Lane writes: > Tom> about that for v11, but I'd favor trying to improve the situation > Tom> in v12. > > Yeah. Another issue I ran into is that if you use SPI_prepare_params, > then you have to use

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-26 Thread Chapman Flack
On 05/26/18 15:22, Andrew Gierth wrote: > So what I'm thinking now is that the way to go, if one wants to imitate > the client-side protocol behavior closely, would be to have a setup hook > that calls parse_variable_parameters the first time, and then > parse_fixed_parameters on subsequent calls

Re: SPI/backend equivalent of extended-query Describe(statement)?

2018-05-26 Thread Chapman Flack
On 05/26/18 10:03, Tom Lane wrote: > Really our hook mechanism only supports adding hooks, not removing them. I suppose the pllua_spi_prepare_checkparam_hook could be linked in once and for all, and turned on and off just where the code now hooks and unhooks it, and just forward to the next hook

Re: json results parsing

2018-05-31 Thread Chapman Flack
On 05/31/18 20:20, Charles Cui wrote: > To clarify, I think my question is functions like json_each or > json_object_keys() are > set returning functions ( > https://www.postgresql.org/docs/9.5/static/functions-srf.html), > which means it returns a set of results into a Datum. Well, it returns

Re: Why is fncollation in FunctionCallInfoData rather than fmgr_info?

2018-06-05 Thread Chapman Flack
On 06/05/2018 04:57 PM, Andres Freund wrote: > But we don't really change the > collation of function invocations per-call. Is that true? (Not a rhetorical question; I'm unsure.) Is your argument that the expression's collation is determined once for each call /site/, and thereafter doesn't

do I correctly understand these date/time data types?

2018-06-24 Thread Chapman Flack
Checking my understanding as in $subject: A TIMESTAMP WITH TIME ZONE has had its specified time zone used at the point of entry to convert it to Z time, and then discarded. If I have to map one of these to a date/time-with-time-zone datatype in another language, I may as well unconditionally map

Is PG built on any C compilers where int division floors?

2018-06-24 Thread Chapman Flack
C99 finally pinned down what / does on signed ints, truncating toward zero. Before that, it could truncate toward zero, or floor toward -inf. Is PostgreSQL built on any compilers/platforms that have the floor behavior? -Chap

Re: Is PG built on any C compilers where int division floors?

2018-06-26 Thread Chapman Flack
On 06/24/18 23:38, Tom Lane wrote: > Chapman Flack writes: >> C99 finally pinned down what / does on signed ints, truncating toward zero. >> Before that, it could truncate toward zero, or floor toward -inf. >> Is PostgreSQL built on any compilers/platforms that have

reassure me that it's good to copy pg_control last in a base backup

2017-12-21 Thread Chapman Flack
I've been using a base backup script that takes special care to have pg_control be the last file it grabs. And I see that basebackup.c takes similar care:

Re: reassure me that it's good to copy pg_control last in a base backup

2017-12-21 Thread Chapman Flack
On 12/22/17 00:29, Michael Paquier wrote: > exclusive backup API can lead to problems? Imagine the case where > you take a exclusive backup and the instance from which a backup is > taken crashes, *with* a backup_label file on disk. Oops. That's one > reason behind non-exclusive backups, which is

archive restore command failure status [was Re: patch proposal]

2017-12-21 Thread Chapman Flack
>On 16 August 2016 at 09:06, Stephen Frost wrote: >> From PG's perspective, >> your restore command has said that all of the WAL has been replayed. >> >> If that's not what you want then change your restore command to >> return an exit code > 125, which tells PG that it's

numeric regression test passes, but why?

2018-01-10 Thread Chapman Flack
I see there are some tests in src/test/regress: sql/numeric.sql expected/numeric.out They pass. I see "numeric ... ok" in a make check. I do not doubt they are being run, because if I edit numeric.sql and fudge some digits, say around -- cases that used to error out select 0.12 ^ (-25); select

Re: numeric regression test passes, but why?

2018-01-11 Thread Chapman Flack
On 01/11/18 02:07, Tom Lane wrote: > Hm, it won't help your sanity to know that those cases pass fine > for me, interactively, on a couple of different machines: > ... > You sure you're using a stock build of Postgres? No handmade > versions of operator ^ lying around? Interesting thought

Re: numeric regression test passes, but why?

2018-01-11 Thread Chapman Flack
On 01/11/2018 07:44 AM, Sergei Kornilov wrote: > Hello > I am surprised, but i can confirm error on versions prior 9.6: on 9.5, 9.4, > 9.3 same error. On 9.6 and 10 query works correctly One of my tests (in fact, the one where I first noticed) was a build from git a couple days ago at

Re: numeric regression test passes, but why?

2018-01-11 Thread Chapman Flack
On 01/11/2018 11:23 AM, Alvaro Herrera wrote: > Dagfinn Ilmari Mannsåker wrote: >> ilm...@ilmari.org (Dagfinn Ilmari Mannsåker) writes: >> >>> The behaviour seems to have changed in 9.6: >> >> Indeed, https://www.postgresql.org/docs/current/static/release-9-6.html >> has the following entry: >> >>

Re: let's make the list of reportable GUCs configurable (was Re: Add %r substitution for psql prompts to show recovery status)

2018-01-10 Thread Chapman Flack
On 01/10/2018 11:08 AM, Robert Haas wrote: > I think that we really need to think about allowing clients to tell > the server which GUCs they'd like reported, instead of having a single > list to which everyone is bound. +1 That already sounded like a good idea back in

Re: let's make the list of reportable GUCs configurable (was Re: Add %r substitution for psql prompts to show recovery status)

2018-01-10 Thread Chapman Flack
On 01/10/2018 03:11 PM, Robert Haas wrote: > it will only work on versions that support that option, but that is > true of any new feature. Furthermore, they will easily be able to > tell based on the reported server version whether or not their request > for different behavior was accepted by

Re: Re: [HACKERS] pgbench randomness initialization

2018-01-09 Thread Chapman Flack
each client does not (if there is more than one per thread), and as soon as real select() delays start happening in CSTATE_WAIT_RESULT, the clients dealt out to a given thread may not be hitting that thread's generator in a deterministic order. -Chap >From 4fe8f8563fedcb04b167db476adaf3bc398f879d Mon Se

Re: pgbench randomness initialization

2018-01-09 Thread Chapman Flack
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: not tested Documentation:not tested Initial review is the message this is in reply to. The new status

Re: proposal: alternative psql commands quit and exit

2018-01-06 Thread Chapman Flack
I'm not sure what the usual shape of 'consensus' or 'resolution' is in these things, but it seems to me that the branch of this email thread that leads here (through the message from Robert that I'm replying to) is the one that felt like it was converging. I thought it was converging on the

Re: proposal: alternative psql commands quit and exit

2018-01-17 Thread Chapman Flack
On 01/17/18 06:50, Geoff Winkless wrote: > Having said all that, has anyone suggested grabbing and writing out > using the "stty quit" value? That appears to work whatever level > you're at, readline-or-not, mid-line or not. It wasn't even something > I was aware of. Well, the usual use of

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Chapman Flack
On 01/15/18 11:56, David Fetter wrote: >> And while trying to find the EOF setting in libreadline might get >> messy, you're already assuming that ctrl-C hasn't been knobbled >> using stty intr. Unless you want to go searching for that too? > > I'm pretty sure changing either or both of those

Re: proposal: alternative psql commands quit and exit

2018-01-15 Thread Chapman Flack
On 01/15/18 16:32, David Fetter wrote: > On Mon, Jan 15, 2018 at 01:24:45PM -0500, Chapman Flack wrote: >> On 01/15/18 11:56, David Fetter wrote: >>>> And while trying to find the EOF setting in libreadline might get >>>> messy, you're already assuming that ctrl-

Re: Would a BGW need shmem_access or database_connection to enumerate databases?

2018-01-24 Thread Chapman Flack
Thanks! I had actually registered that one (with a related one) for CF 2018-03, having missed the deadline for -01: https://commitfest.postgresql.org/17/1467/ -Chap On 01/24/2018 01:20 PM, Bruce Momjian wrote: > On Thu, Dec 14, 2017 at 06:12:35PM -0500, Chapman Flack wrote: >> On 12/0

pie-in-sky idea: 'sensitive' function parameters

2018-02-02 Thread Chapman Flack
CREATE FUNCTION commence_primary_ignition(target text, password text) RETURNS void AS ...; SELECT commence_primary_ignition(target=>'Alderaan', password=>'1234'); /* 1234 could appear in logs, activity stats ... disturbing */ CREATE OR REPLACE FUNCTION commence_primary_ignition( target

Re: [HACKERS] MERGE SQL Statement for PG11

2018-01-29 Thread Chapman Flack
On 01/29/2018 11:13 AM, Simon Riggs wrote: > On 29 January 2018 at 15:44, Bruce Momjian wrote: >> Uh, if we know we are going to get question on this, the patch had >> better have an explanation of when to use it. Pushing the problem to >> later doesn't seem helpful. > > What

Re: git instructions

2018-02-01 Thread Chapman Flack
On 02/01/2018 10:54 AM, Magnus Hagander wrote: > in saying that git:// is faster than https://. In fact, we have some > reports and testing that https:// can be significantly faster (due to other > reasons). Can you elaborate on the other reasons? It occurs to me that there might be cases in

Re: [HACKERS] WIP: Aggregation push-down

2018-01-29 Thread Chapman Flack
On 01/29/18 03:32, Antonin Houska wrote: > Robert Haas wrote: >>> only take place if we had a special equality operator which distinguishes >>> the >>> *binary* values (I don't know yet how to store this operator the catalog --- ... >> We don't have an operator that tests

Re: pie-in-sky idea: 'sensitive' function parameters

2018-02-03 Thread Chapman Flack
On 02/02/18 22:46, Tom Lane wrote: > ... the problem with this idea is that knowledge that the item ought to be > hidden would be obtained only very late in the parsing process. So for > example if you fat-fingered something just to the left of the function > call in the query text, or the name

Ok then, how *should* one get the value of an XML attribute?

2018-02-09 Thread Chapman Flack
Since commit aaf15e5, a text value doesn't reliably roundtrip through representation as an XML attribute. At least, not like this: WITH t(v) AS (SELECT text 'This & That'), x(e) AS (SELECT xmlelement(name foo, xmlattributes(v)) FROM t), y(v1) AS (SELECT (xpath('/foo/@v', e))[1]::text FROM x)

Precision loss casting float to numeric

2018-02-25 Thread Chapman Flack
Back in https://www.postgresql.org/message-id/4e384467-f28a-69ce- 75aa-4bc01125a39d%40anastigmatix.net I got intrigued about casting float values to numeric. Two queries below (one for float4, one for float8) show what happens for float values with bits of precision from one up to the limit of

Re: Precision loss casting float to numeric

2018-02-25 Thread Chapman Flack
. -Chap >From 5b3b05009830b29d1d3167bcd3321228535161dc Mon Sep 17 00:00:00 2001 From: Chapman Flack <c...@anastigmatix.net> Date: Sun, 25 Feb 2018 22:52:22 -0500 Subject: [PATCH 1/2] Add regression test for cast float[48] to numeric. At this stage, as expected, it fails. --- src/tes

Re: Precision loss casting float to numeric

2018-02-26 Thread Chapman Flack
On 02/26/2018 01:29 PM, Tom Lane wrote: > I think there's probably a bigger chance of complaints that > "casting 1.1::float8 to numeric now produces some weird, > incorrectly-rounded result" than that we make anyone happier. Arguably, though, that's a moment that can be used to explain exactly

Re: How can we submit code patches that implement our (pending) patents?

2018-07-27 Thread Chapman Flack
On 07/27/2018 01:01 PM, Andres Freund wrote: > the patch and people doing so can reasonably be expected to know about > the patents, making further contributions by them worse. I'm not sure this line of thinking, which seems rooted in notions of tainted or cleanroom development from the

Re: How can we submit code patches that implement our (pending) patents?

2018-07-27 Thread Chapman Flack
On 07/27/2018 01:42 PM, Andres Freund wrote: > On 2018-07-27 13:33:28 -0400, Chapman Flack wrote: >> On 07/27/2018 01:01 PM, Andres Freund wrote: >> >>> the patch and people doing so can reasonably be expected to know about >>> the patents, making further contr

Re: Facility for detecting insecure object naming

2018-08-14 Thread Chapman Flack
On 08/14/2018 07:01 PM, Nico Williams wrote: > On Tue, Aug 14, 2018 at 03:00:55PM +, Robert Haas wrote: >> The more I think about it, the more I think having a way to set a >> lexically-scoped search path is probably the answer. [...] > > Yes please! > > This is what I want. Evaluate the

Re: Facility for detecting insecure object naming

2018-08-16 Thread Chapman Flack
On 08/16/18 21:31, Bruce Momjian wrote: > I understand you don't like that a search_path changed by a function is > passed down to functions it calls, but what would you like the system to > use as a search path for called functions? The search path of the > session? This is beginning to sound

Re: lazy detoasting

2018-08-12 Thread Chapman Flack
On 04/11/18 11:27, Chapman Flack wrote: > In most cases I can easily imagine, a function that gets an SQLXML > object is going to read it "pretty soon" ... > However, the spec does explicitly provide that you could, for whatever > reason, sit on the thing for a whi

Re: libpq should not look up all host addresses at once

2018-08-09 Thread Chapman Flack
On 08/09/2018 11:05 AM, Tom Lane wrote: > So I think what this code should do is (1) look up each hostname as it > needs it, not all at once, and (2) proceed on to the next hostname > if it gets a DNS lookup failure, not fail the whole connection attempt > immediately. As attached. Would it be

Re: Windows vs C99 (was Re: C99 compliance for src/port/snprintf.c)

2018-08-21 Thread Chapman Flack
On 08/21/2018 01:46 PM, Tom Lane wrote: > Andres Freund writes: >> On 2018-08-21 13:29:20 -0400, Tom Lane wrote: >>> We've got a buildfarm handy that could answer the question. >>> Let's just stick a test function in there for a day and see >>> which animals fail. > >> I think we pretty much

Re: typcache.c typos

2018-08-28 Thread Chapman Flack
On 08/28/18 09:21, Michael Paquier wrote: > On Tue, Aug 28, 2018 at 01:57:12PM +0900, Amit Langote wrote: >> - * The type cache exists to speed lookup of certain information about data >> [ ... ] >> + * The type cache exists to speedup lookups of certain data type information >> >> Sorry if I'm

Re: How can we submit code patches that implement our (pending) patents?

2018-07-23 Thread Chapman Flack
On 07/23/2018 10:01 AM, Bruce Momjian wrote: > And the larger question is whether a patent free for use by software > under any license can be used in a defensive way. If not, it means we > have no way forward here. Isn't 'defensive', in patent-speak, used to mean 'establishing prior art usable

Re: How can we submit code patches that implement our (pending) patents?

2018-07-25 Thread Chapman Flack
On 07/25/18 01:56, Nico Williams wrote: > Wrong. With patents the important thing is not to know about them when > you implement -- if you come up with the same idea by accident (which, > of course, is obviously entirely possible) then you are not subject to > trebble damages. Even if the

Re: How can we submit code patches that implement our (pending) patents?

2018-07-25 Thread Chapman Flack
On 07/25/2018 11:25 AM, Nico Williams wrote: > I don't understand why it's not obvious that one can unknowingly and > accidentally re-invent someone else's idea. It's perfectly obvious. It's the chief reason the whole topic of software patents has been deeply controversial for so long. You seem

Re: How can we submit code patches that implement our (pending) patents?

2018-07-23 Thread Chapman Flack
On 07/23/2018 10:25 AM, Bruce Momjian wrote: >> Isn't 'defensive', in patent-speak, used to mean 'establishing prior >> art usable to challenge future patent claims by others on the same >> technique'? >> >> Is there any way that conditions of use, or lack of them, on an >> existing patent, would

Re: How can we submit code patches that implement our (pending) patents?

2018-07-24 Thread Chapman Flack
On 07/24/2018 11:20 AM, Alvaro Herrera wrote: > Probably easiest way forward is to state the requirement and have > someone untainted by the patent come up with a clean-room > re-implementation. That sounds like an approach based on copyright considerations. A patent, on the other hand, will

Re: Removing useless \. at the end of copy in pgbench

2018-08-29 Thread Chapman Flack
On 08/29/2018 10:35 AM, Fabien COELHO wrote: > The "may" is because I could *not* test: I could not run a 8.2 on my > laptop, "initdb" fails on: > >  creating template1 database in > <...>/src/test/regress/./tmp_check/data/base/1 ... ok >  initializing pg_authid ... FATAL:  wrong number of index

*_to_xml() should copy SPI_processed/SPI_tuptable

2018-09-05 Thread Chapman Flack
I encountered this in 9.5 and haven't yet written a reproducer for 10 or 11, but the code in question looks the same in master. In xml.c, query_to_xml_internal() contains a loop that refers to SPI_processed every iteration: for (i = 0; i < SPI_processed; i++) SPI_sql_row_to_xmlelement(i,

Re: *_to_xml() should copy SPI_processed/SPI_tuptable

2018-09-05 Thread Chapman Flack
On 09/05/18 18:07, Tom Lane wrote: > * Replace SPI_tuptable et al with macros that access fields in the > current SPI stack level (similar to the way that, eg, errno works > on most modern platforms). This seems do-able, if a bit grotty. It would mean they'd have to *be* in the stack frame,

Re: Stored procedures and out parameters

2018-08-30 Thread Chapman Flack
On 08/30/18 15:35, Robert Haas wrote: > On Tue, Aug 28, 2018 at 6:30 AM, Peter Eisentraut > wrote: >> CALL compatible with the SQL standard. For example, if you have a >> function f1(IN a int, OUT b int), you would call it as SELECT f1(x) >> and the "b" would somehow be the return value. But a

Re: Use C99 designated initializers for some structs

2018-08-29 Thread Chapman Flack
On 08/29/18 18:51, Tom Lane wrote: > As against that, of course, explicitly zeroing fields that you know very > well are already zero eats some cycles. I've occasionally wondered if I haven't checked what a smart C99 compiler actually emits for a designated initializer giving a field a

Re: proposal: alternative psql commands quit and exit

2018-01-13 Thread Chapman Flack
On 01/13/18 21:36, Everaldo Canuto wrote: > I don't wanna be irritating but here every postgres user I found really > can't understand how the original patch was not accepted, people against it > did not show good reasons. As I was watching this thread go by, the reasons being shown seemed good

Re: Security leak with trigger functions?

2018-01-22 Thread Chapman Flack
On 12/14/2006 01:17 PM, Peter Eisentraut wrote: > Tom Lane wrote: >> Peter Eisentraut writes: >>> By extrapolation of the SQL standard, I'd say we'd need to check >>> the EXECUTE privilege of the function at run time. >> >> Certainly EXECUTE privilege is what to check, but whose

Re: PATCH: Configurable file mode mask

2018-03-13 Thread Chapman Flack
On 03/13/2018 01:50 PM, Stephen Frost wrote: > Yes, that's true, but PG has never paid attention to POSIX ACLs or Linux > capabilities. Changing it to do so is quite a bit beyond the scope... I think we're largely in agreement here, as my aim was not to advocate that PG should work harder to

Re: PATCH: Configurable file mode mask

2018-03-13 Thread Chapman Flack
r tramples over what the admin takes care to set up. On 03/13/2018 03:44 PM, Stephen Frost wrote: > * Chapman Flack (c...@anastigmatix.net) wrote: >> So my suggestion boils down to PG having at least an option, somehow, >> to be well-behaved in that sense. > > I'm afraid

Re: PATCH: Configurable file mode mask

2018-03-13 Thread Chapman Flack
On 03/13/2018 10:40 AM, Stephen Frost wrote: > * Michael Paquier (mich...@paquier.xyz) wrote: >> Well, one thing is that the current checks in the postmaster make sure >> that a data folder is never using anything else than 0700. From a >> security point of view, making it possible to allow a

Re: worker_spi.naptime in worker_spi example

2018-03-15 Thread Chapman Flack
On 03/15/2018 10:59 AM, Jeremy Finzel wrote: > WaitLatch function the same variable worker_spi_naptime without referencing > the configuration created in _PG_init. Am I missing something here? You can see the declaration of that variable up on line 56. It's just an int variable static to

Re: worker_spi.naptime in worker_spi example

2018-03-15 Thread Chapman Flack
On 03/15/2018 04:19 PM, Jeremy Finzel wrote: > Thank you. I did see worker_spi_naptime definition, but I wanted to > pass worker_spi_naptime > as an argument instead into worker_spi_main so that I can control via SQL > interface how frequently the worker SQL executes. Is this possible? Are you

Re: Re: pgbench randomness initialization

2018-03-15 Thread Chapman Flack
I'm sorry, I must have missed your reply on the 5th somehow. On 03/05/18 07:01, Fabien COELHO wrote: > I must admit that I'm not too happy with the result as well, so I dropped > the octal/hexadecimal parsing. That seems perfectly reasonable to me; perfectly adequate to accept only one base.

Re: lazy detoasting

2018-04-04 Thread Chapman Flack
On 04/01/18 01:19, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> If I copy an out-of-line, on-disk TOAST pointer into a memory context >> with transaction lifetime, with an eye to detoasting it later in the >> same transaction, are there circumsta

Re: [PATCH] Update README for Resource Owners

2018-04-06 Thread Chapman Flack
On 04/06/18 19:52, Andres Freund wrote: > On 2018-04-06 19:46:25 -0400, Chapman Flack wrote: >> Hasn't been updated as built-in support grew for temp files, DSM segments, >> and JIT contexts. >> >> With enough luck, a README update won't break anything. >

Re: [PATCH] Update README for Resource Owners

2018-04-06 Thread Chapman Flack
On 04/06/18 20:19, Chapman Flack wrote: > On 04/06/18 19:52, Andres Freund wrote: >> Wouldn't it be a better idea not to have a list there, that's guaranteed >> to get out of date? > > That might look like this, then. > > But I'm not sure how bad it is to

[PATCH] Update README for Resource Owners

2018-04-06 Thread Chapman Flack
Hasn't been updated as built-in support grew for temp files, DSM segments, and JIT contexts. With enough luck, a README update won't break anything. -Chap >From fb06e17916ad6b445b1cf6361de6a7f2749ea225 Mon Sep 17 00:00:00 2001 From: Chapman Flack <c...@anastigmatix.net> Date: Fri, 6 Ap

Re: lazy detoasting

2018-04-09 Thread Chapman Flack
On 04/08/2018 02:01 AM, Andrew Gierth wrote: > Chapman> (d) some other reason I haven't thought of ? > > It has to be pushed as the active snapshot so that it's the snapshot > that the executor uses to run the query to populate the tuplestore which > becomes the "held" portal content. That

Re: lazy detoasting

2018-04-10 Thread Chapman Flack
On 04/10/2018 10:06 AM, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> Am I right in thinking that, for my original purpose of >> detoasting something later in a transaction, all that matters >> is that I registered a snapshot from the time at wh

Re: lazy detoasting

2018-04-10 Thread Chapman Flack
On 04/10/2018 05:04 PM, Chapman Flack wrote: > ... I wonder if > there's at least a cheap way to check a particular snapshot > for suitability wrt a given toast pointer. Check a couple usual > suspects, find one most of the time, fall back to eager detoasting > otherwise? > &g

Re: lazy detoasting

2018-04-10 Thread Chapman Flack
On 04/10/2018 04:03 PM, Robert Haas wrote: > I suspect you want, or maybe need, to use the same snapshot as the > scan that retrieved the tuple containing the toasted datum. I'm sure it's worth more than that, but I don't know if it's implementable. If I'm a function, and the datum came to me

Re: lazy detoasting

2018-04-10 Thread Chapman Flack
On 04/10/2018 05:04 PM, Chapman Flack wrote: > If I'm a function, and ... I found [the datum] myself, say by an > SPI query within the function, usually that's at a level of abstraction > somewhere above what-snapshot-was-used-in-the-scan. It looks like for that case (since the commit

Re: lazy detoasting

2018-04-11 Thread Chapman Flack
On 04/10/2018 10:17 PM, Jan Wieck wrote: > If your session has a transaction snapshot that protects the old toast > slices from being vacuumed away, you are fine. That harks back to my earlier (naïve?) thought that, as long as my lazy datum doesn't have to outlive the transaction, lazy detoasting

Re: lazy detoasting

2018-04-11 Thread Chapman Flack
On 04/11/2018 10:41 AM, Tom Lane wrote: > The core of the problem now is that in a READ COMMITTED transaction, we > may not be holding any snapshot at all between statements. So if you're > hanging onto a toast pointer across statements you're at risk. > > On the other hand, it's also arguable

Re: lazy detoasting

2018-04-11 Thread Chapman Flack
On 04/11/2018 11:33 AM, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> The mission is to implement java.sql.SQLXML, which has long been >> missing from PL/Java. >> This is the class of object your Java code can retrieve from a >> ResultSet ro

Re: lazy detoasting

2018-04-11 Thread Chapman Flack
On 04/11/2018 01:55 PM, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> Well, the devilsAdvocate() function would stash the object >> in a static, then try to look at it some time in a later call >> in the same transaction. > > If you're wo

Re: lazy detoasting

2018-04-11 Thread Chapman Flack
On 04/11/2018 03:04 PM, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> that it might *not* be sufficient to find an applicable snapshot at >> the time of constructing the object, and register that snapshot >> on TopTransactionResourceOwner? >

  1   2   >