Re: [GENERAL] How to add columns to view with dependencies

2017-04-16 Thread Tom Lane
Guyren Howe writes: > Seems like a simple question, but I’ve never found a good answer to this and > similar issues. > I would think it was safe to let me add columns to a view on which other > views depend, but Postgres won’t let me. > I can imagine ways of sort-of dealing

Re: [GENERAL] How to add columns to view with dependencies

2017-04-16 Thread Justin Pryzby
On Sun, Apr 16, 2017 at 08:02:54PM -0700, Guyren Howe wrote: > Seems like a simple question, but I’ve never found a good answer to this and > similar issues. > > I would think it was safe to let me add columns to a view on which other > views depend, but Postgres won’t let me. > > I can

[GENERAL] How to add columns to view with dependencies

2017-04-16 Thread Guyren Howe
Seems like a simple question, but I’ve never found a good answer to this and similar issues. I would think it was safe to let me add columns to a view on which other views depend, but Postgres won’t let me. I can imagine ways of sort-of dealing with this. I might maintain a SQL file with

Re: [GENERAL] Clone PostgreSQL schema

2017-04-16 Thread Melvin Davidson
On Sun, Apr 16, 2017 at 4:42 PM, R. Reiterer wrote: > Unfortunately, I do not have the skills to improve the function. Maybe > someone at dba.stackexchange.com can help me. I'll open a ticket. I hope > this is okay for you. > > Am 16.04.2017 22:31 schrieb Melvin Davidson: >

Re: [GENERAL] Nice to have features: Percentage function

2017-04-16 Thread Adrian Klaver
On 04/16/2017 02:33 PM, Michael Nolan wrote: I also have some pre-defined percentage functions, they check the denominator and return null if it is zero, to avoid 'divide by zero' errors. Are they available somewhere? My previous examples where more proof of concept then complete. -- Mike

Re: [GENERAL] Nice to have features: Percentage function

2017-04-16 Thread Adrian Klaver
On 04/16/2017 09:37 AM, Melvin Davidson wrote: On Sun, Apr 16, 2017 at 12:23 PM, Adrian Klaver *Or, you could just as easily compute inline in SQL: SELECT datname, pg_size_pretty(pg_database_size(datname))as size_pretty, pg_database_size(datname) as size, (SELECT

Re: [GENERAL] Nice to have features: Percentage function

2017-04-16 Thread Michael Nolan
I also have some pre-defined percentage functions, they check the denominator and return null if it is zero, to avoid 'divide by zero' errors. -- Mike Nolan On Sun, Apr 16, 2017 at 11:37 AM, Melvin Davidson wrote: > > > On Sun, Apr 16, 2017 at 12:23 PM, Adrian Klaver

Re: [GENERAL] Nice to have features: Percentage function

2017-04-16 Thread Melvin Davidson
On Sun, Apr 16, 2017 at 12:23 PM, Adrian Klaver wrote: > On 04/15/2017 10:47 PM, Ron Ben wrote: > >> Hi, >> I'm always finiding myself writing many varations of functions to >> calculate percentage. >> I think it would be nice if postgresql would have build in

Re: [GENERAL] Nice to have features: Percentage function

2017-04-16 Thread Adrian Klaver
On 04/15/2017 10:47 PM, Ron Ben wrote: Hi, I'm always finiding myself writing many varations of functions to calculate percentage. I think it would be nice if postgresql would have build in functions for that. I think the major functionality is something like the 3 ooptions here:

Re: [GENERAL] Nice to have features: Percentage function

2017-04-16 Thread Adrian Klaver
On 04/15/2017 10:47 PM, Ron Ben wrote: Hi, I'm always finiding myself writing many varations of functions to calculate percentage. I think it would be nice if postgresql would have build in functions for that. If you have already written the functions, why not just use them? To make them