[GENERAL] Not possible to compare regrole in a view query?

2017-09-04 Thread Glen Huang
I have this simple view definition: CREATE TEMP VIEW user_schema AS SELECT nspname AS name FROM pg_namespace WHERE nspname = 'public' OR nspowner = ‘rolename'::regrole; But it fails to create the view by complaining: constant of the type "regrole" cannot be used here If I run the query

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-04 Thread Nico Williams
On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins wrote: > > > > Me too. > > https://github.com/wttw/pgsidekick > > Select-based, sends periodic keep-alives to keep the connection open, > outputs payloads in a way that's friendly to pipe into xargs. (Also the > bare bones of a notify-based scheduler).

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Ryan Murphy
> I'm pretty sure it doesn't work syntactically. Don't recall the details offhand. Ok, thanks!

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Tom Lane
Ryan Murphy writes: > Interesting! It seems like one "simple" possiblity would be to allow ANY() > to be on either side...or would that muck up the Grammar too badly or have > weird edge cases where it doesn't make sense? I'm pretty sure it doesn't work syntactically. Don't recall the details of

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Ryan Murphy
> > I'm not sure why we've never got round to providing such a thing > in core ... probably lack of consensus on what to name the reverse > operator. You'd need to support regex cases as well, so there's > more than one operator name to come up with. > Interesting! It seems like one "simple" poss

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Tom Lane
Ryan Murphy writes: > But is there any way to do: > select * from post > where any(tags) LIKE 'music%'; > ?? > This doesn't work because ANY is only allowed on the right. Yeah. The traditional answer is "make yourself a reverse LIKE operator, one that takes the pattern on the left". You can bru

[GENERAL] hidden maintenance_work_mem limitations of a Windows build

2017-09-04 Thread reugen1984
Hi PG developers, it has recently come to my attention that Win and Nix flavors or Postgres (including upcoming 10.0 beta 3) are not equal in terms of limits on maintenance_work_mem parameter. Even when you try to set it to miserable 2gb, on Windows you get  "outside the valid range for paramete

[GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Ryan Murphy
e.g. I know you can do select * from post where 'music' = any(tags); Which is similar to saying tags @> '{music}'. And I see that I can even do: select * from post where 'music' LIKE any(tags); ...implying that ANY is more general in some ways than @>, e.g. it can would with LIKE as well as =.

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-04 Thread Steve Atkins
> On Sep 3, 2017, at 3:32 PM, Nico Williams wrote: > > > My principal problem with psql(1) relative to NOTIFY/LISTEN is that > psql(1) won't check for them until it has had some input on stdin. So > it will appear to do nothing when it's idle, even if there millions of > notifies for it to res

[GENERAL] Surprising locking behavior with CTE, FOR SHARE, and UPDATE

2017-09-04 Thread Seamus Abshere
I have a query that splits up work (and manually does locking) according to an id range: WITH new_data AS ( SELECT [...] FROM data WHERE id BETWEEN 1 AND 2 -- here's my "id range" ), old_data AS ( SELECT [...] FROM data WHERE id IN (SELECT id FROM new_data) FOR UPDATE -- a manual lock to

[GENERAL] Undefined Reference

2017-09-04 Thread Stefan Wagner
I'm apologizing in advance for the double post. Since my first one wasn't composed very thoughtfull and hasn't gotten any responses.   Im new to postgresql and trying to create a new Clause in the source code. Thanks to some advice in this Mailing List I've been able to start coding.   I'm usin