[HACKERS] Where is it documented what role executes constraint triggers?

2017-11-03 Thread Chapman Flack
>From a little experimenting in 9.5, it seems that a referential integrity trigger is executed with the identity of the referencED table's owner, but I have not been able to find this covered in the docs. Is this a documentation oversight, or is it explained somewhere I didn't look (or may have

Re: [HACKERS] Faster methods for getting SPI results

2017-09-12 Thread Chapman Flack
On 09/12/17 17:00, Tom Lane wrote: > I did not see any reason given in the thread why we should need that. > If you want to accumulate tuples ten at a time before you do something > with them, you can do that now, by calling ExecutorRun with count=10. Ah, that sounds easy enough. I'll withdraw

Re: [HACKERS] Faster methods for getting SPI results

2017-09-12 Thread Chapman Flack
On 09/12/2017 03:41 PM, Tom Lane wrote: > So the conclusion at the end of the last commitfest was that this patch > should be marked Returned With Feedback, and no new work appears to have > been done on it since then. Why is it in this fest at all? There > certainly doesn't seem to be any

Re: [HACKERS] Replication vs. float timestamps is a disaster

2017-09-06 Thread Chapman Flack
On 09/06/17 18:33, Omar Kilani wrote: > Is there anything people using float datetimes can do that isn't a > pg_dumpall | pg_restore to do a less painful update? > > We have several TB of data still using float datetimes and I'm trying > to figure out how we can move to 10 (currently on 9.6.x)

Re: [HACKERS] Faster methods for getting SPI results

2017-08-01 Thread Chapman Flack
On 12/20/16 23:14, Jim Nasby wrote: > I'm guessing one issue might be that > we don't want to call an external interpreter while potentially holding page > pins, but even then couldn't we just copy a single tuple at a time and save > a huge amount of palloc overhead? On 04/06/17 03:38, Craig

[HACKERS] Re: [PATCH] Pattern based listeners for asynchronous messaging (LISTEN/NOTIFY)

2017-07-31 Thread Chapman Flack
On 07/31/17 16:30, Peter Eisentraut wrote: > I would think about specifying an operator somewhere in the syntax, like > you have with LISTEN SIMILAR TO. It would even be nice if a > non-built-in operator could be used for matching names. Hmm ... as I was reading through the email thread, I saw

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-07-26 Thread Chapman Flack
On 07/17/17 11:29, Michael Paquier wrote: > FWIW, I would rather see any optimization done in > AdvanceXLInsertBuffer() instead of seeing a second memset re-zeroing > the WAL page header after its data has been initialized by > AdvanceXLInsertBuffer() once. Is that an aesthetic 'rather', or is

Re: [HACKERS] SCRAM auth and Pgpool-II

2017-07-14 Thread Chapman Flack
On 07/13/2017 10:46 PM, Chapman Flack wrote: > Neither is suitable on an unencrypted channel (as has been repeatedly Please forgive my thinko about md5. I had overlooked the second salted md5 used in the protocol, and that had to be some years ago when I was sure I had looked for one in the c

Re: [HACKERS] SCRAM auth and Pgpool-II

2017-07-13 Thread Chapman Flack
On 07/13/17 21:54, Tatsuo Ishii wrote: >>> The comment in pg_hba.conf.sample seem to prefer md5 over clear text >>> password. >>> >>> # Note that "password" sends passwords in clear text; "md5" or >>> # "scram-sha-256" are preferred since they send encrypted passwords. >> >> Should that be

Re: [HACKERS] SCRAM auth and Pgpool-II

2017-07-13 Thread Chapman Flack
On 07/13/17 20:09, Tatsuo Ishii wrote: > The comment in pg_hba.conf.sample seem to prefer md5 over clear text > password. > > # Note that "password" sends passwords in clear text; "md5" or > # "scram-sha-256" are preferred since they send encrypted passwords. Should that be reworded to

Re: [HACKERS] idea: custom log_line_prefix components besides application_name

2017-07-12 Thread Chapman Flack
On 07/12/17 08:38, Robert Haas wrote: > another protocol message. I feel like the usefulness of this for > connection pooling software is pretty obvious: it's a lot easier for > the pooler to disallow a certain protocol message than a certain SQL > command. I assume you mean easier than

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-07-03 Thread Chapman Flack
On 07/03/2017 09:39 AM, Heikki Linnakangas wrote: > Hmm. That's not the problem, though. Imagine that instead of the loop > above, you do just: > > WALInsertLockUpdateInsertingAt(CurrPos); > AdvanceXLInsertBuffer(EndPos, false); > > AdvanceXLInsertBuffer() will call XLogWrite(), to flush out

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-07-03 Thread Chapman Flack
On 07/03/2017 09:39 AM, Heikki Linnakangas wrote: > The most straightforward solution would be to just clear each page with > memset() in the loop. It's a bit wasteful to clear the page again, just > after AdvanceXLInsertBuffer() has initialized it, but this isn't > performance-critical. An in

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-06-29 Thread Chapman Flack
On 06/25/17 21:20, Chapman Flack wrote: > I want to make sure I understand what the deadlock potential is > in this case. AdvanceXLInsertBuffer will call WaitXLogInsertionsToFinish > ... > Does not the fact we hold all the insertion slots exclude the possibility > that any dirty bu

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-06-25 Thread Chapman Flack
I notice CopyXLogRecordToWAL contains this loop (in the case where the record being copied is a switch): while (CurrPos < EndPos) { /* initialize the next page (if not initialized already) */ WALInsertLockUpdateInsertingAt(CurrPos); AdvanceXLInsertBuffer(CurrPos, false); CurrPos

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-06-22 Thread Chapman Flack
On 06/21/17 04:51, Heikki Linnakangas wrote: > (I'm cleaning up my inbox, hence the delayed reply) I had almost completely forgotten ever bringing it up. :) > When I wrote that code, I don't remember if I realized that we're > initializing the page headers, or if I thought that it's good enough

Re: [HACKERS] postgresql transactons not fully isolated

2017-06-20 Thread J Chapman Flack
On 06/20/2017 12:33 PM, Merlin Moncure wrote: > postgres=# create table ints (n int); > CREATE TABLE > postgres=# insert into ints values (1); > INSERT 0 1 > postgres=# insert into ints values (2); > INSERT 0 1 > > T1: BEGIN > T1: UPDATE ints SET n = n + 1; > T2: BEGIN > T2: DELETE FROM ints

Re: [HACKERS] postgresql transactons not fully isolated

2017-06-20 Thread Chapman Flack
On 06/20/2017 03:08 PM, Chapman Flack wrote: > For me (in PG 9.5 at $work), at the instant of the commit in T1, > T2 says: > ERROR: could not serialize access due to concurrent update I get that result in 'serializable' and in 'repeatable read'. I get the reported result (DELETE 0 an

Re: [BUGS] [HACKERS] Re: Postgresql bug report - unexpected behavior of suppress_redundant_updates_trigger

2017-06-19 Thread Chapman Flack
On 06/19/2017 05:19 PM, David G. Johnston wrote: > At first glance I think I'd rather have it do the correct thing all of > the time, even if it takes longer, so that my only trade-off decision > is whether to improve performance by fixing the application. > > Ideally if the input tuple wouldn't

[HACKERS] Re: Postgresql bug report - unexpected behavior of suppress_redundant_updates_trigger

2017-06-19 Thread J Chapman Flack
On 06/19/2017 11:40 AM, Dilip Kumar wrote: > ... Artus de benque ... wrote: >> ...=# UPDATE test_table SET field = rpad('', 2001, 'a') WHERE id = 1; > > Seems like in "suppress_redundant_updates_trigger" we are comparing > toasted tuple with the new tuple and that is the cause of the bug.

[HACKERS] oidin / oidout and InvalidOid

2017-06-12 Thread Chapman Flack
Hi, I was recently guilty of writing a less-than-clear SQL example because I plain forgot whether InvalidOid was 0 (correct) or -1 (my bad). Would there be any sense in letting oidin_subr accept the string InvalidOid for 0? I understand that changing oidout could break existing code outside of

[HACKERS] regproc and when to schema-qualify

2017-06-11 Thread Chapman Flack
I was idly following along in GSoC 2017: Foreign Key Arrays when I noticed this: =# select * from pg_amproc where amprocfamily = 2745; amprocfamily | amproclefttype | amprocrighttype | amprocnum | amproc --++-+---+ 2745 |

Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node

2017-06-07 Thread Chapman Flack
On 06/02/17 15:51, Chapman Flack wrote: > But what it buys you is then if your MyExtraPGNode has PostgresNode > as a base, the familiar idiom > > MyExtraPGNode->get_new_node('foo'); > > works, as it inserts the class as the first argument. > > As a bonus, you th

Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node

2017-06-02 Thread Chapman Flack
On 06/02/2017 12:50 PM, Robert Haas wrote: > On Thu, Jun 1, 2017 at 3:36 AM, Michael Paquier >> >> +$pgnclass = 'PostgresNode' unless defined $pgnclass; >> I'd rather leave any code of this kind for the module maintainers, > > Craig's proposal is a standard Perl idiom, though. Would it not

Re: [HACKERS] TAP: allow overriding PostgresNode in get_new_node

2017-06-02 Thread J Chapman Flack
On 06/02/2017 12:50 PM, Robert Haas wrote: > On Thu, Jun 1, 2017 at 3:36 AM, Michael Paquier >> >> +$pgnclass = 'PostgresNode' unless defined $pgnclass; >> I'd rather leave any code of this kind for the module maintainers, > > Craig's proposal is a standard Perl idiom, though. Would it not

Re: [HACKERS] [PATCH] quiet conversion warning in DatumGetFloat4

2017-06-01 Thread Chapman Flack
On 06/01/17 17:41, Tom Lane wrote: > 12169 warnings generated by -Wconversion > 4106 warnings generated by -Wconversion -Wno-sign-conversion > ... > So it's better with -Wno-sign-conversion, but I'd say we're still not > going there anytime soon. On an optimistic note, there might not turn out to

Re: [HACKERS] [PATCH] quiet conversion warning in DatumGetFloat4

2017-05-31 Thread Chapman Flack
On 05/31/2017 11:36 AM, Tom Lane wrote: > However, I grant your point that some extensions may have outside > constraints that mandate using -Wconversion, so to the extent that > we can keep key headers like postgres.h from triggering those warnings, > it's probably worth doing. I suspect you're

Re: [HACKERS] [PATCH] quiet conversion warning in DatumGetFloat4

2017-05-30 Thread Chapman Flack
On 05/31/17 01:26, Tom Lane wrote: > Hm. I think it would be better to use DatumGetInt32 here. Arguably, > direct use of GET_4_BYTES and its siblings should only appear in > DatumGetFoo macros. Like so? These are the 4 sites where {GET,SET}_n_BYTES got introduced in 14cca1b (for consistency,

[HACKERS] [PATCH] quiet conversion warning in DatumGetFloat4

2017-05-30 Thread Chapman Flack
It seems that 14cca1b (use static inline functions for float <-> Datum conversions) has an implicit narrowing conversion in one of those functions. If building an extension with gcc's -Wconversion warning enabled (*cough* pljava *cough* ... the Maven plugin that runs the compiler enables the

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-22 Thread Chapman Flack
On 05/22/17 18:39, Alvaro Herrera wrote: > Chapman Flack wrote: >> CREATE INDEX ON foo USING btree ( bar, baz ALSO quux ); > > INCLUDING: > https://www.postgresql.org/message-id/56168952.4010...@postgrespro.ru I'd buy that. -Chap -- Sent via pgsql-hackers mailing l

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-22 Thread Chapman Flack
On 05/22/2017 05:16 AM, Amit Kapila wrote: > Agreed, but even if we have any such syntax, making it work for hash > indexes is tricky, because we currently store the hash code in the > index, not the original hash index key. That was what gave me the idea in the first place, which then I realized

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-21 Thread Chapman Flack
On 05/19/17 11:41, Tom Lane wrote: > No, nobody's done anything about allowing hash indexes to support > uniqueness AFAIK. I don't have a clear picture of how much work > it would be, but it would likely be more than trivial effort; I see what you mean. Because of the way hash values are

[HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-19 Thread Chapman Flack
Hi, The item on hash indexes reminded me of an old comment from years ago that I put in the code of the first custom PG datatype I ever built at $work: COMMENT ON OPERATOR CLASS puid_ops USING btree IS 'As puids are only identifiers, there is no obvious reason to define ordering operators or

Re: [HACKERS] idea: custom log_line_prefix components besides application_name

2017-05-10 Thread Chapman Flack
On 05/10/2017 03:56 AM, Craig Ringer wrote: > On 10 May 2017 10:44 am, "Chapman Flack" <c...@anastigmatix.net> wrote: >> On 05/09/17 18:48, Mark Dilger wrote: >>> SET SESSION ON BEHALF OF 'joe user' > > No need to do anything they custom and specific

Re: [HACKERS] idea: custom log_line_prefix components besides application_name

2017-05-09 Thread Chapman Flack
On 05/09/17 18:48, Mark Dilger wrote: > I don't have any positive expectation that the postgres community will go > along with any of this, but just from my point of view, the cleaner way to > do what you are proposing is something like setting a session variable. > > In your middle tier java

Re: [HACKERS] idea: custom log_line_prefix components besides application_name

2017-05-09 Thread Chapman Flack
On 05/09/2017 01:25 PM, Mark Dilger wrote: > Consensus, no, but utility, yes. > > In three tier architectures there is a general problem that the database > role used by the middle tier to connect to the database does not entail > information about the user who, such as a visitor to your

[HACKERS] idea: custom log_line_prefix components besides application_name

2017-05-04 Thread Chapman Flack
Hi, At $work I am often entertained by log entries like: invalid input syntax for integer: "21' && 1=2)) Uni/**/ON SEl/**/eCT 0x646665743166657274,0x646665743266657274, 0x646665743366657274 -- " They're entertaining mostly because I know our web guy has heard of SQL injection and doesn't write

Re: [HACKERS] If an extension library is loaded during pg_upgrade, can it tell?

2017-04-03 Thread Chapman Flack
On 04/03/17 22:08, Bruce Momjian wrote: > On Mon, Apr 3, 2017 at 09:53:34PM -0400, Chapman Flack wrote: >> Hi, >> >> Is there any distinctive state that could be checked by extension code >> to determine that it has been loaded incidentally during the operation >>

[HACKERS] If an extension library is loaded during pg_upgrade, can it tell?

2017-04-03 Thread Chapman Flack
Hi, Is there any distinctive state that could be checked by extension code to determine that it has been loaded incidentally during the operation of pg_upgrade rather than under normal conditions? PL/Java ordinarily checks what version of its schema is around, but that may be premature while

[HACKERS] who calls InitializeTimeouts() ?

2016-11-02 Thread Chapman Flack
Hi, It looks like for about 3 years, PL/Java has been calling InitializeTimeouts before calling RegisterTimeout. Looking over the callers of InitializeTimeouts in core, though, it appears that an extension like PL/Java should be able to assume it has already been called, and in fact would be rude

Re: [HACKERS] 9.6, background worker processes, and PL/Java

2016-10-26 Thread Chapman Flack
On 10/26/16 07:04, Amit Kapila wrote: > No, parallel workers in parallel query doesn't have MyProcPort. Ok ... it turns out I was using MyProcPort as a quick way to grab database_name and user_name (very early in startup, for a purpose analogous to setting a 'ps' process title), and that seemed

Re: [HACKERS] 9.6, background worker processes, and PL/Java

2016-10-25 Thread Chapman Flack
On 10/25/16 18:56, Chapman Flack wrote: > If pooled, and tied to the backend that started them, do they need > to do anything special to detect when the leader has executed > SET ROLE or SET SESSION AUTHORIZATION? Let me guess ... such information is *not* synchronized across workers, a

[HACKERS] 9.6, background worker processes, and PL/Java

2016-10-25 Thread Chapman Flack
Hi, I have a report of a PL/Java crash in 9.6 where the stack trace suggests it was trying to initialize in a background worker process (not sure why that even happened, yet), and by my first glance, it seems to have crashed dereferencing MyProcPort, which I am guessing a BGW might not always

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-08-02 Thread Chapman Flack
On 08/02/2016 02:33 PM, Bruce Momjian wrote: > My guess is that the bytes are there to detect problems where > a 512-byte disk sector is zeroed by a disk failure. Does that seem plausible? (a) there is only one such header for every 16 512-byte disk sectors, so it only affords a 6% chance of

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-07-26 Thread Chapman Flack
On 07/26/16 20:01, Michael Paquier wrote: > On Tue, Jul 26, 2016 at 9:48 PM, Amit Kapila wrote: >> Does any body else see the use case >> reported by Chapman important enough that we try to have some solution >> for it in-core? > > The lack of updates in the pg_lesslog

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-07-26 Thread Chapman Flack
On 07/26/2016 04:21 PM, Robert Haas wrote: > I'm kind of curious WHY you are using archiving and forcing regular > segment switches rather than just using streaming replication. > ... AFAIK, streaming replication > essentially obsoleted that use case. You can just dribble the > individual bytes

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-07-26 Thread Chapman Flack
On 07/26/2016 08:48 AM, Amit Kapila wrote: > general, if you have a very low WAL activity, then the final size of > compressed WAL shouldn't be much even if you use gzip. It seems your 9.5 pg_xlog, low activity test cluster (segment switches forced only by checkpoint timeouts), compressed with

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-07-25 Thread Chapman Flack
On 07/25/16 22:09, Michael Paquier wrote: > This is over-complicating things for little gain. The new behavior of > filling in with zeros the tail of a segment makes things far better > when using gzip in archive_command. Then how about filling with actual zeros, instead of with mostly-zeros as

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-07-25 Thread Chapman Flack
On 07/23/2016 08:25 AM, Amit Kapila wrote: > On Sat, Jul 23, 2016 at 3:32 AM, Chapman Flack <c...@anastigmatix.net> wrote: >> >> Would it then be possible to go back to the old behavior (or make >> it selectable) of not overwriting the full 16 MB every time? >> &

[HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2016-07-22 Thread Chapman Flack
Teaser: change made in 9.4 to simplify WAL segment compression made it easier to compress a low-activity-period WAL segment from 16 MB to about 27 kB ... but much harder to do better than that, as I was previously doing (about two orders of magnitude better). At $work, we have a

Re: [HACKERS] Postgres 9.6 scariest patch tournament

2016-04-19 Thread Chapman Flack
On 04/18/2016 04:22 PM, Josh berkus wrote: > > We should send the owner of the scariest patch something as a prize. > Maybe a plastic skeleton or something ... A mouse. -Chap -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Chapman Flack
On 04/15/16 18:03, Alvaro Herrera wrote: > I suppose you could create a copy of the tuple (SysCacheSearchCopy) and > use that for HeapTupleGetDatum. The problem with the syscache tuple is > that it can go away as soon as you do the ReleaseSysCache -- it lives in > shared_buffers memory, so when

[HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Chapman Flack
Please bear with a neophyte question ... I am tempted to apply HeapTupleGetDatum to a tuple retrieved from the syscache (as I already have code for processing a tuple presented as a Datum). But I see a comment on HeapTupleHeaderGetDatum: "This must *not* get applied to an on-disk tuple; the

[HACKERS] Safe to apply HeapTupleHeaderGetDatum to a tuple from syscache?

2016-04-13 Thread Chapman Flack
I'm still learning, and looking at the HeapTupleHeaderGetDatum comment that says This must *not* get applied to an on-disk tuple; the tuple should be freshly made by heap_form_tuple or some wrapper routine for it (such as BuildTupleFromCStrings). Be sure also that the tupledesc used to

Re: [HACKERS] Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)

2016-03-21 Thread Chapman Flack
On 03/21/2016 10:21 AM, Aleksander Alekseev wrote: > Well in this case here is a patch that fixes "use of uninitialized > value" reports by MemorySanitizer I managed to catch so far. I'm new here so someone more experienced would have to weigh in, but I would wonder a couple of things: a.

[HACKERS] Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)

2016-03-21 Thread Chapman Flack
On 03/21/2016 06:08 AM, Aleksander Alekseev wrote: > As you may see there are "holes" that were in fact not filled. Under > normal conditions they will be filled with data previously stored on > stack which could be anything including passwords and other private > data. Afterwards this structure

Re: [HACKERS] Make primnodes.h gender neutral

2016-03-19 Thread Chapman Flack
On 03/17/16 19:09, Robert Haas wrote: > On Thu, Mar 17, 2016 at 6:34 PM, Chapman Flack <c...@anastigmatix.net> wrote: > Not to pick on you in particular... > Debating whether or not somebody is currently upset about this, and > how upset the are, and what the value is of fi

Re: [HACKERS] Make primnodes.h gender neutral

2016-03-19 Thread Chapman Flack
On 03/17/16 17:29, Kevin Grittner wrote: > On Thu, Mar 17, 2016 at 4:11 PM, Tom Lane wrote: > >> Sexist language is a distraction >> for some, in-your-face non-sexism (such as made-up pronouns) is a >> distraction for others, bad or awkward grammar is a distraction for yet >>

Re: [HACKERS] typmod is always -1

2016-03-19 Thread Chapman Flack
On 03/17/16 09:35, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> I'm in the same boat ... I have an input function I want to test, and so >> far I have failed to think of *any* sql construct that causes it to be >> invoked with other than -

[HACKERS] typmod is always -1

2016-03-18 Thread Chapman Flack
nothing like resurrecting a really old thread ... > Pavel Stehule writes: >> I have a problem - every call of mvarcharin is with typmod = -1. 2009/3/17 Tom Lane : > Also, there are a bunch of scenarios where we rely on a cast

[HACKERS] pstrdup(TextDatumGetCString(foo)) ?

2016-03-09 Thread Chapman Flack
I am encountering, here and there, an idiom like pstrdup(TextDatumGetCString(foo)) or a pre-8.4 version, pstrdup(DatumGetCString(DirectFunctionCall1(textout, foo))) It's leading me to question my sanity because it appears to me that both text_to_cstring (underlying TextDatumGetCString) and

[HACKERS] Managing a long-held TupleDesc reference

2016-03-08 Thread Chapman Flack
When PL/Java is told to map a PostgreSQL composite type to a certain Java class, on its first use of the type mapping it calls lookup_rowtype_tupdesc_noerror and then creates a PL/Java UDT structure that retains a reference to the TupleDesc. This seems to be what is leading to a TupleDesc

[HACKERS] character_not_in_repertoire vs. untranslatable_character

2016-03-06 Thread Chapman Flack
So there's an ISO error 22021 "character not in repertoire" and a PostgreSQL error 22P05 "untranslatable character" that seem very similar. If I look in backend/utils/mb/wchar.c, it looks as if PostgreSQL uses the first for the case of a corrupted encoding (bytes that can't be decoded to a

Re: [HACKERS] PostgreSQL extension API? Documentation?

2016-02-27 Thread Chapman Flack
On 02/27/16 14:11, Álvaro Hernández Tortosa wrote: > Why would it be so much work? Creating a function list, and maybe > documenting those, doesn't sound like a daunting task. > > I wouldn't mind volunteering for this work, but I guess I would need > some help to understand and identify

Re: [HACKERS] PostgreSQL extension API? Documentation?

2016-02-27 Thread Chapman Flack
On 02/27/16 13:51, Álvaro Hernández Tortosa wrote: > ... I still lack a list of functions that might be callable (I > understand not even those labeled with PGDLLIMPORT are all good candidates > and some good candidates might not be labeled as such) from an extension > point of view. Have you

Re: [HACKERS] PostgreSQL extension API? Documentation?

2016-02-27 Thread Chapman Flack
On 02/27/16 08:37, Álvaro Hernández Tortosa wrote: > In other words: what is the API surface exposed by PostgreSQL to > extension developers? The assumption is that no PostgreSQL code should be > modified, just adding your own and calling existing funcitons. That's an excellent question that

Re: [HACKERS] about google summer of code 2016

2016-02-21 Thread Chapman Flack
On 02/21/16 23:10, Tom Lane wrote: > Another variable is that your answers might depend on what format you > assume the client is trying to convert from/to. (It's presumably not > text JSON, but then what is it?) This connects tangentially to a question I've been meaning to ask for a while,

Re: [HACKERS] How are CREATE EXTENSION ... VERSION or ALTER EXTENSION ... UPDATE TO ... intended to work?

2016-02-21 Thread Chapman Flack
On 02/16/16 22:44, Tom Lane wrote: > Chapman Flack <c...@anastigmatix.net> writes: >> been several releases of an extension, and the extensions directory >> is now populated with a bunch of files quux--1.0.sql, quux--1.1.sql, >> quux--1.0--1.1.sql, quux--1.1-

[HACKERS] MinGW / Windows / printf format specifiers

2016-02-18 Thread Chapman Flack
So I announce a PL/Java 1.5.0-BETA1 with a comment that windows-MSVC was well tested but that I hadn't found anyone to test windows-mingw, and behold, what should happen but someone turns up with an interest in testing the mingw build, so we might have that back in shape as well for -BETA2.

Re: [HACKERS] about google summer of code 2016

2016-02-18 Thread Chapman Flack
On 02/18/16 19:35, Amit Langote wrote: > Apparently, the deadline is: February 20, 2016 at 04:00 (+0900 UTC) > > https://summerofcode.withgoogle.com/ For anybody finding that web site as anti-navigable as I did, here are more direct links to the actual rules, and terms of agreement for the

[HACKERS] How are CREATE EXTENSION ... VERSION or ALTER EXTENSION ... UPDATE TO ... intended to work?

2016-02-16 Thread Chapman Flack
I've been looking a little more deeply at the extension mechanism, trying to answer my own question about what happens once there have been several releases of an extension, and the extensions directory is now populated with a bunch of files quux--1.0.sql, quux--1.1.sql, quux--1.0--1.1.sql,

Re: [HACKERS] A bit of PG archeology uncovers an interesting Linux/Unix factoid

2016-02-15 Thread Chapman Flack
On 02/15/16 20:03, Greg Stark wrote: > On Tue, Feb 16, 2016 at 12:51 AM, Chapman Flack <c...@anastigmatix.net> wrote: >> If the calling process subsequently waits for its >> children, and the process has no unwaited for children that were >> transformed into zomb

Re: [HACKERS] A bit of PG archeology uncovers an interesting Linux/Unix factoid

2016-02-15 Thread Chapman Flack
On 02/15/16 13:42, Greg Stark wrote: > (it returns error with errno ECHILD upon successful completion of > commands). > This fix ignores an error from system() if errno == ECHILD. > > It looks like Linux now behaves similarly, It seems to be official, in the Single Unix Specification:

Re: [HACKERS] Mac OS: invalid byte sequence for encoding "UTF8"

2016-02-10 Thread Chapman Flack
On 02/10/16 17:19, Tom Lane wrote: > I also verified that in UTF8-based locales, isspace() thinks that 0x85 and > 0xA0, and no other high-bit-set values, are spaces. Not sure exactly why Unicode NEXT LINE (NEL) and NO-BREAK SPACE, respectively.

Re: [HACKERS] Mac OS: invalid byte sequence for encoding "UTF8"

2016-02-10 Thread Chapman Flack
On 02/10/16 23:55, Tom Lane wrote: > Yeah, I got that --- what seems squishier is that none of the other C1 > control characters are considered whitespace? That seems to be exactly the case: http://www.unicode.org/Public/5.2.0/ucd/PropList.txt 09..0D, 20, 85, and A0 are the only whitespace

Re: [HACKERS] proposal: schema PL session variables

2016-02-08 Thread Chapman Flack
[resending because thunderbird helpfully defaulted my sender address to the one that -isn't- subscribed to -hackers, sorry] On 02/08/2016 03:16 AM, Pavel Stehule wrote: > Only a owner of schema can edit functions inside schema Can't anyone granted CREATE on the schema do that? Would that be

Re: [HACKERS] Implementing a new Scripting Language

2016-01-27 Thread Chapman Flack
On 01/27/16 16:31, Igal @ Lucee.org wrote: > This can be a major thing. I will open a ticket in > https://github.com/tada/pljava -- or is it already on the roadmap? Now that you mention it, it isn't officially in a ticket. Though it's not like I was going to forget. :) I can guarantee it won't

Re: [HACKERS] Implementing a new Scripting Language

2016-01-27 Thread Chapman Flack
On 01/27/16 22:26, Igal @ Lucee.org wrote: > If I can help with anything with the pl/Java project I'd love to help. Man, you do NOT know what you just walked into. :D The most imminent thing I see happening is s/1.5.0-SNAPSHOT/1.5.0-BETA1 which is not far off, so testing is always good. Maybe

Re: [HACKERS] Implementing a new Scripting Language

2016-01-27 Thread Chapman Flack
On 01/27/2016 11:46 AM, Igal @ Lucee.org wrote: >> Have you checked PL/Java? > That seems like a good place to start, thanks. Are there also any docs > about the subject? I just did a quick search on Lucee and what I found suggests that it compiles to JVM bytecode and runs on a JVM. If that is

Re: [HACKERS] Implementing a new Scripting Language

2016-01-27 Thread Chapman Flack
On 01/27/2016 01:17 PM, Igal @ Lucee.org wrote: > the next version of Lucee (currently in Beta) does support JSR-223, > which I actually mentioned as a viable solution in my first email in Sorry, I jumped in late. > this thread. That would be awesome if PL/Java would support JSR-223. Ok, if

Re: [HACKERS] Implementing a new Scripting Language

2016-01-27 Thread Chapman Flack
On 01/27/2016 02:06 PM, Igal @ Lucee.org wrote: > two-twenty-three, not thirty ;)), Thanks. :) On occasions in the past I have written it correctly ... there is evidence in the archives > we will be able to use Javascript > through that via the Nashorn project, Yes, that's an attraction

Re: [HACKERS] proposal: PL/Pythonu - function ereport

2016-01-26 Thread Chapman Flack
On recent occasions, Pavel Stehule and Catalin Iacob have written: ... >> But *inside* PLPython what I wrote is true, see this example for what I >> mean: >> >> CREATE FUNCTION test() >> RETURNS int >> AS $$ >> def a_func(): >> raise plpy.Error('an error') >> >> try: >> a_func() >>

[HACKERS] is there a deep unyielding reason to limit U&'' literals to ASCII?

2016-01-23 Thread Chapman Flack
I see in the documentation (and confirm in practice) that a Unicode character string literal U&'...' is only allowed to have s representing Unicode characters if the server encoding is, exactly and only, UTF8. Otherwise, it can still have s, but they can only be in the range \+01 to \+7f

[HACKERS] Re: Fwd: [JDBC] Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102

2016-01-13 Thread Chapman Flack
Maybe more work, but: Could a custom plan be cached /along with the values of the parameters for which it was planned/? Then it's kind of a no-brainer to say "if the parameters are the same this time, I'm probably looking at the best plan already." Pretty simpleminded, but at least it would

Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2016-01-05 Thread Chapman Flack
On 01/05/2016 09:18 AM, Chapman Flack wrote: > On 01/05/2016 12:53 AM, Michael Paquier wrote: > >> That's not a mandatory fix, but I think we had better do it. As long >> as dynloader.h is copied in include/, there is no need to keep the >> tweak of dfmgr.c to inclu

Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2016-01-05 Thread Chapman Flack
On 01/05/2016 12:53 AM, Michael Paquier wrote: > That's not a mandatory fix, but I think we had better do it. As long > as dynloader.h is copied in include/, there is no need to keep the > tweak of dfmgr.c to include the definitions those routines. Looking at what you changed, all becomes clear.

Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2016-01-04 Thread Chapman Flack
On 01/05/16 00:18, Michael Paquier wrote: > with MSVC what is used instead of dynloader.h is > port/dynloader/win32.h. Seems like a good catch - AFAICS, what happens with port/dynloader is that for 12 different OSes, there's an .h file there to be copied _renamed to dynloader.h_ into the build

Re: CurrentExtensionObject was Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2015-12-31 Thread Chapman Flack
On 12/31/15 16:13, Tom Lane wrote: >> I see that 9.5.0 already adds PGDLLIMPORT on the global variable >> creating_extension, but CurrentExtensionObject on the very next >> line of extension.h still doesn't have it. > > Why would you need to access that? This returns to the earlier question

Re: [HACKERS] tracking owner of extension-managed objects

2015-12-31 Thread Chapman Flack
On 12/31/15 19:06, Jim Nasby wrote: > Those columns are there to tell you what *kind* of objects are involved in > the dependency. For example, a function will have two entries. classid will > be 1255 (pg_proc) for both of them. refclassid will be 2612 (pg_language) > for one and 2615

CurrentExtensionObject was Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2015-12-31 Thread Chapman Flack
While on the subject of things that could make it or not into 9.5.?, I see that 9.5.0 already adds PGDLLIMPORT on the global variable creating_extension, but CurrentExtensionObject on the very next line of extension.h still doesn't have it. The simplest way I've come up with in Windows to

Re: [HACKERS] tracking owner of extension-managed objects

2015-12-31 Thread Chapman Flack
On 12/23/15 15:02, Jim Nasby wrote: > BTW, I've been pondering a very similar problem to this. I'm working on a > metacoding framework, and it's inevitable that at some point it will want to > know what objects it's created > > I was planning on just making a best possible attempt and solving

Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2015-12-30 Thread Chapman Flack
On 12/30/15 20:40, Bruce Momjian wrote: > your hack will have to be active until 9.4 gets to end-of-life, or > perhaps 9.5 if we can't get this into 9.5.0. People who are using 9.5 > Beta or RC will still not have the file, meaning 9.5 end-of-life might > still be a requirement. ... by which

Re: [HACKERS] dynloader.h missing in prebuilt package for Windows?

2015-12-29 Thread Chapman Flack
On 12/29/15 14:08, Bruce Momjian wrote: > This should fix the PL/Java Windows build problem. I don't think I will > get this patch into 9.5.0 but will put it in after 9.5.0 is released and > it will appear in all the next minor version releases, including 9.5.1, > which should happen in the next

Re: [HACKERS] missing "SPI_finish" that isn't missing

2015-12-28 Thread Chapman Flack
On 12/24/15 16:37, Tom Lane wrote: > to make this coding pattern work is to set up a subtransaction, and either > commit it in the success path or roll it back upon catching an error. > (This is not terribly well documented, but the exception-block handling > in plpgsql provides a working model

[HACKERS] missing "SPI_finish" that isn't missing

2015-12-24 Thread Chapman Flack
I probably just need to learn the right coding pattern for this. What is it? What I want this code to do: a) If there is a table 'mytable', set theSavedStuff to a pstrdup'd in TopMemoryContext copy of column s from one row if present. b) In case of an error because there is no table

Re: [HACKERS] tracking owner of extension-managed objects

2015-12-21 Thread Chapman Flack
On 12/21/2015 12:46 PM, Tom Lane wrote: > BTW, any such ownership relationship really needs to be reflected into > pg_shdepend, else someone might drop a role that still owns objects. > (I guess there are problems with extensions trying to do such things at > all, since we don't provide a way for

Re: [HACKERS] tracking owner of extension-managed objects

2015-12-21 Thread Chapman Flack
On 12/21/2015 02:30 PM, Chapman Flack wrote: > On 12/21/2015 12:46 PM, Tom Lane wrote: >> all, since we don't provide a way for extensions to hook into the DROP >> mechanisms. Perhaps that should be fixed.) > > That is literally *the very next* e-mail I was going to compos

[HACKERS] tracking owner of extension-managed objects

2015-12-21 Thread Chapman Flack
I'm looking for best-practice advice. PL/Java is an extension that manages some objects (jar files, which users can tell PL/Java to load, drop, or replace). The objects have owners (have had since PL/Java 1.1.0 anyway). When the owner tracking was added for 1.1.0 it recorded the owner oid. In

Re: [HACKERS] Threads in PostgreSQL

2015-12-20 Thread Chapman Flack
s stack pointer, which will naturally give you a bogus result. There is some API in miscadmin.h for manipulating the backend's idea of the stack base, but there be dragons. I am far short of the knowledgeable voices here, but in case you don't hear from them right away, that is at least how I understand th

Re: [HACKERS] Proposal: custom compression methods

2015-12-13 Thread Chapman Flack
On 12/14/15 01:50, Craig Ringer wrote: > pg_upgrade means you can't just redefine the current toast bits so the > compressed bit means "data is compressed, check first byte of varlena data > for algorithm" because existing data won't have that, the first byte will > be the start of the compressed

  1   2   >