Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-04 Thread Jim Nasby
On 1/3/16 10:37 PM, Tom Lane wrote: It's not a release stopper, but I plan to fix it in HEAD whenever I have an idle hour. Since I'm sure there's much better things you can be working on I was going to just do this myself. Then it occurred to me that this should be a great item for a new

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Michael Paquier
On Mon, Jan 4, 2016 at 11:16 AM, Tom Lane wrote: > Jim Nasby writes: >> regrole and regnamespace don't run their output through quote_ident(). >> That's contrary to all the other reg* operators. > >> Worse, they also don't *allow* quoted input. Not

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
I wrote: > There's no real advantage to that anyway, compared with just doing > stringToQualifiedNameList and then complaining if its list_length isn't 1. Or just use SplitIdentifierString directly ... regards, tom lane -- Sent via pgsql-hackers mailing list

[HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
I didn't see this discussed on the thread... regrole and regnamespace don't run their output through quote_ident(). That's contrary to all the other reg* operators. Worse, they also don't *allow* quoted input. Not only is that different from reg*, it's the *opposite*: select 'with

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Jim Nasby writes: > regrole and regnamespace don't run their output through quote_ident(). > That's contrary to all the other reg* operators. > Worse, they also don't *allow* quoted input. Not only is that different > from reg*, it's the *opposite*: BTW, there's a

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Michael Paquier writes: > On Mon, Jan 4, 2016 at 11:16 AM, Tom Lane wrote: >> I'm inclined to think that you're right, and that this is something that >> ought to be changed. It's not quite too late ... > Well, I can send a patch with some tests

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Jim Nasby writes: > regrole and regnamespace don't run their output through quote_ident(). > That's contrary to all the other reg* operators. > Worse, they also don't *allow* quoted input. Not only is that different > from reg*, it's the *opposite*: I'm inclined to

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Jim Nasby writes: > On 1/3/16 9:23 PM, Tom Lane wrote: >> I'm inclined to leave to_regrole and to_regnamespace alone, though, since >> they have no numeric-OID path, and they will provide an "out" for anyone >> who wants to handle nonquoted names. (Though at least in

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 9:23 PM, Tom Lane wrote: Jim Nasby writes: regrole and regnamespace don't run their output through quote_ident(). That's contrary to all the other reg* operators. Worse, they also don't *allow* quoted input. Not only is that different from reg*, it's the

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Jim Nasby writes: > What I went with. Now to figure out why this is happening... >SELECT regnamespace('pg_catalog'); > ! ERROR: schema "Y" does not exist > ! LINE 1: SELECT regnamespace('pg_catalog'); Confusion between a C string and a string Value node, mayhap?

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Michael Paquier
On Mon, Jan 4, 2016 at 1:20 PM, Jim Nasby wrote: > On 1/3/16 9:43 PM, Tom Lane wrote: >> >> Jim Nasby writes: >>> >>> On 1/3/16 9:23 PM, Tom Lane wrote: >>> Another potential problem for regnamespace is that it doesn't allow an >>> entry for

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 10:20 PM, Jim Nasby wrote: What I went with. Now to figure out why this is happening... Nevermind, see my stupidity now. Should have full patch soon. -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 11:05 PM, Michael Paquier wrote: I'll take a look, but Michael, if you have time to review, an extra set >of eyeballs wouldn't hurt. There is no margin for error right now. I'm just on it:) Will update in a couple of minutes, I noticed some stuff in Jim's patch. BTW, in case you

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 10:46 PM, Jim Nasby wrote: Added. I'm gonna call this good for now. Note this is just against HEAD since I don't have 9.5 setup yet. Presumably the patch should still apply... BTW, in case it's helpful... https://github.com/decibel/postgres/tree/regquote -- Jim Nasby, Data

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 11:24 PM, Michael Paquier wrote: Sorry, didn't realize you were on it. No worries. I know it's already late where you are. And late where 9.5 is... ;) I would use != 1 instead here, even if the function is strict. Yeah, I effectively pulled the pattern from

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Jim Nasby writes: > On 1/3/16 9:23 PM, Tom Lane wrote: >> (Though at least in HEAD we ought to >> fix them to take type text as input. Using cstring for ordinary functions >> is just sloppy.) > BTW, *all* the reg*in() functions do that... Yeah, I noticed that.

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 10:26 PM, Michael Paquier wrote: Thanks, this is more or less what I... just did.. Sorry, didn't realize you were on it. +result = get_namespace_oid(nsp_name, false); This is incorrect, you should use strVal(linitial(names)) instead. Yup. Dur. +if (list_length(names) >

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Michael Paquier writes: > Attached is an updated patch which passes > check-world in my environment. Pushed with trivial cosmetic changes to the code, and slightly more extensive work on the regression test cases. It strikes me that there might be an argument for

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Michael Paquier
On Mon, Jan 4, 2016 at 3:09 PM, Tom Lane wrote: > Michael Paquier writes: >> Attached is an updated patch which passes >> check-world in my environment. > > Pushed with trivial cosmetic changes to the code, and slightly more > extensive work on the

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 9:43 PM, Tom Lane wrote: Jim Nasby writes: On 1/3/16 9:23 PM, Tom Lane wrote: Another potential problem for regnamespace is that it doesn't allow an entry for the catalog. I'm not sure what the spec says about that, but every other function allows

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Michael Paquier
On Mon, Jan 4, 2016 at 2:01 PM, Tom Lane wrote: > Jim Nasby writes: >> On 1/3/16 10:26 PM, Michael Paquier wrote: >>> Thanks, this is more or less what I... just did.. > >> Sorry, didn't realize you were on it. > >>> A couple of tests in regproc.sql

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Michael Paquier
On Mon, Jan 4, 2016 at 1:46 PM, Jim Nasby wrote: > On 1/3/16 10:26 PM, Michael Paquier wrote: >> >> Thanks, this is more or less what I... just did.. > > > Sorry, didn't realize you were on it. No worries. I know it's already late where you are. >> A couple of tests in

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Jim Nasby
On 1/3/16 9:23 PM, Tom Lane wrote: (Though at least in HEAD we ought to fix them to take type text as input. Using cstring for ordinary functions is just sloppy.) BTW, *all* the reg*in() functions do that... -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics,

Re: [HACKERS] 9.5 BLOCKER: regrole and regnamespace and quotes

2016-01-03 Thread Tom Lane
Jim Nasby writes: > On 1/3/16 10:26 PM, Michael Paquier wrote: >> Thanks, this is more or less what I... just did.. > Sorry, didn't realize you were on it. >> A couple of tests in regproc.sql would be a good addition as well. > Added. I'm gonna call this good for now.