Re: How to keep format of views source code as entered?

2021-01-07 Thread David G. Johnston
On Thu, Jan 7, 2021 at 4:38 PM raf wrote: > > Hi, I've only used stored functions (not views or > triggers), Extrapolating to these other types of objects based upon experiences with functions isn't all that helpful. and Postgres has never altered > the code that it stores, Right, you use fu

Re: How to keep format of views source code as entered?

2021-01-07 Thread raf
On Thu, Jan 07, 2021 at 05:33:48PM +, "Markhof, Ingolf" wrote: > So, it looks like PostgreSQL does support saving the original source code of > a view. > > What's best practise to use as a code repository? > > I would expect support of multi-user access, access-right management and > per

RE: Is there a good discussion of optimizations?

2021-01-07 Thread Kevin Brannen
From Guyren Howe >Actually, I’m mostly going to talk about the relational model, rather than >SQL. Our industry seems to always settle for third-best, and SQL is the worst >of all the examples of this. The world desperately needs a good relational >database based on a better query language — dat

Re: Is there a good discussion of optimizations?

2021-01-07 Thread Rob Sargent
On 1/7/21 2:48 PM, Guyren Howe wrote: On Jan 7, 2021, 13:42 -0800, Florents Tselai , wrote: Apologies for the shameless self-promotion :) Around a year ago I collected my thoughts on this topic. You can read the post here Modern Data Practice and the SQL Tradition

Re: Is there a good discussion of optimizations?

2021-01-07 Thread Guyren Howe
On Jan 7, 2021, 13:42 -0800, Florents Tselai , wrote: > Apologies for the shameless self-promotion :) > > Around a year ago I collected my thoughts on this topic. You can read the > post here Modern Data Practice and the SQL Tradition . > It looks like it resonated with a lot of folks in the commu

Re: Is there a good discussion of optimizations?

2021-01-07 Thread Florents Tselai
Apologies for the shameless self-promotion :) Around a year ago I collected my thoughts on this topic. You can read the post here Modern Data Practice and the SQL Tradition . It looks like it resonated with a lot of folks in the

RE: Is there a good discussion of optimizations?

2021-01-07 Thread Guyren Howe
On Jan 7, 2021, 13:07 -0800, Kevin Brannen , wrote: > From: Guyren Howe > > >Most folks, in my experience, who use relational databases don’t really > >understand the basic theory or even more important the why - the philosophy > >- of what a relational database is and how to get the most out of

RE: Is there a good discussion of optimizations?

2021-01-07 Thread Kevin Brannen
From: Guyren Howe >Most folks, in my experience, who use relational databases don’t really >understand the basic theory or even more important the why - the philosophy - >of what a relational database is and how to get the most out of them. I see a >lot of folks trying to use SQL in an imperat

Re: How to keep format of views source code as entered?

2021-01-07 Thread Christophe Pettus
Hello, > On Jan 7, 2021, at 09:33, Markhof, Ingolf > wrote: > > So, it looks like PostgreSQL does support saving the original source code of > a view. To be clear, PostgreSQL itself does not. The suggestion is to use an external source code repository, such as GitHub, GitLab, or one of (man

RE: How to keep format of views source code as entered?

2021-01-07 Thread Markhof, Ingolf
So, it looks like PostgreSQL does support saving the original source code of a view. What's best practise to use as a code repository? I would expect support of multi-user access, access-right management and perhaps versioning as well…? Thanks for your help! Ingolf From: Markhof, Ingolf [mai

Re: How to keep format of views source code as entered?

2021-01-07 Thread Tom Lane
"Markhof, Ingolf" writes: > I want the SLQ code of my views stored as I entered it. Is there any way to > achieve this? No. Lots of people prefer to keep their SQL code in some sort of source-code-control system, anyway. regards, tom lane

Re: How to keep format of views source code as entered?

2021-01-07 Thread Christophe Pettus
> On Jan 7, 2021, at 08:19, Markhof, Ingolf > wrote: > I want the SLQ code of my views stored as I entered it. Is there any way to > achieve this? Or will I be forced to maintain my views SQL code outside of > PostgreSQL views? The text that you get back from the PostgreSQL system catalogs

How to keep format of views source code as entered?

2021-01-07 Thread Markhof, Ingolf
Hi! Switching from Oracle SLQ to PostgreSQL I am facing the issue that the SQL code the system returns when I open a views source code is different from the code I entered. The code is formatted differently, comments are gone and e.g. all text constants got an explicit cast to ::text added. (se

Re: How to convert escaped text column - force E prefix

2021-01-07 Thread Pavel Stehule
čt 7. 1. 2021 v 15:50 odesílatel David G. Johnston < david.g.johns...@gmail.com> napsal: > On Thursday, January 7, 2021, Pavel Stehule > wrote: > >> >> >> The vulnerability is almost the same although it is a little bit harder >> to create attack strings. >> > > Would making the function run as “

Re: How to convert escaped text column - force E prefix

2021-01-07 Thread David G. Johnston
On Thursday, January 7, 2021, Pavel Stehule wrote: > > > The vulnerability is almost the same although it is a little bit harder to > create attack strings. > Would making the function run as “security definer” and setting up a minimal permissions user/owner help with mitigation? David J.

Re: Using more than one LDAP?

2021-01-07 Thread Paul Förster
Hi Magnus, > On 07. Jan, 2021, at 12:43, Magnus Hagander wrote: > > The docs say "When using an external authentication system such as > Ident or GSSAPI, the name of the operating system user that initiated > the connection might not be the same as the database user (role) that > is to be used."

Re: Onfly Query - cumulative sum the stock change values by articles

2021-01-07 Thread Durumdara
Hello! Durumdara ezt írta (időpont: 2021. jan. 7., Cs, 10:17): > Hello! > > I have a query where I can show the positive and negative future changes > of the articles. > For example: > > select art.id, art.name, art.actual_stock, art.min_stock, > change.stock_change, change.date > from change l

Re: Using more than one LDAP?

2021-01-07 Thread Magnus Hagander
On Thu, Jan 7, 2021 at 10:40 AM Paul Förster wrote: > > Hi Magnus, > > > On 06. Jan, 2021, at 16:57, Magnus Hagander wrote: > > > > Yes. But you have a really hacky environment :P > > actually not. We have an old LDAP which we want to retire this year. And we > also have Windows AD, which offers

Re: How to convert escaped text column - force E prefix

2021-01-07 Thread Pavel Stehule
čt 7. 1. 2021 v 12:13 odesílatel Durumdara napsal: > Dear Members! > > > > Pavel Stehule ezt írta (időpont: 2021. jan. 6., > Sze, 12:03): > >> >> >> >> it cannot work, because \ will be replaced by \\ >> >> postgres=# CREATE OR REPLACE FUNCTION public.unistr(text) >> RETURNS text >> LANGUAGE

Re: How to convert escaped text column - force E prefix

2021-01-07 Thread Durumdara
Dear Members! Pavel Stehule ezt írta (időpont: 2021. jan. 6., Sze, 12:03): > > > > it cannot work, because \ will be replaced by \\ > > postgres=# CREATE OR REPLACE FUNCTION public.unistr(text) > RETURNS text > LANGUAGE plpgsql > IMMUTABLE STRICT > AS $function$ > declare r text; > begin

Re: LDAP(s) doc misleading

2021-01-07 Thread Paul Förster
Hi Magnus, > On 07. Jan, 2021, at 11:04, Magnus Hagander wrote: > > No, I think this is correct. > > "Set to ldaps to use ldaps" means you set it to the value "ldaps" in > order to use ldaps. > > I think you missed the "to" in the sentence -- without that one, your > reading of it would make m

Re: LDAP(s) doc misleading

2021-01-07 Thread Magnus Hagander
On Wed, Jan 6, 2021 at 8:36 AM Paul Förster wrote: > > Hi, > > I found what I believe to be misleading in the LDAP documentation: > > https://www.postgresql.org/docs/current/auth-ldap.html > > It says: > "ldapscheme > Set to ldaps to use LDAPS."... > > IMHO, it should say: > "ldapscheme > Set to l

Re: LDAP(s) doc misleading

2021-01-07 Thread Paul Förster
Hi Stephen, > On 06. Jan, 2021, at 18:14, Stephen Frost wrote: > > When in an Active Directory environment, it's far more secure to use > Kerberos/GSSAPI and not LDAP (or LDAPS). Using the ldap authentication > method with PostgreSQL will result in the credentials of users being > sent to the d

Re: Using more than one LDAP?

2021-01-07 Thread Paul Förster
Hi Magnus, > On 06. Jan, 2021, at 16:57, Magnus Hagander wrote: > > Yes. But you have a really hacky environment :P actually not. We have an old LDAP which we want to retire this year. And we also have Windows AD, which offers LDAP. So the idea is to switch the LDAP environments in PostgreSQL

RE: Keep needing to run manual analyze

2021-01-07 Thread Rob Northcott
-Original Message- From: Laurenz Albe Sent: 07 January 2021 02:06 To: Rob Northcott ; pgsql-gene...@postgresql.org Subject: Re: Keep needing to run manual analyze On Wed, 2021-01-06 at 17:28 +, Rob Northcott wrote: >> We have an application that uses a Postgres database (currently

RE: Keep needing to run manual analyze

2021-01-07 Thread Rob Northcott
From: Michael Lewis Sent: 06 January 2021 18:11 To: Rob Northcott Cc: pgsql-gene...@postgresql.org Subject: Re: Keep needing to run manual analyze On Wed, Jan 6, 2021 at 10:29 AM Rob Northcott mailto:rob.northc...@compilator.com>> wrote: We have an application that uses a Postgres database (cur

Onfly Query - cumulative sum the stock change values by articles

2021-01-07 Thread Durumdara
Hello! I have a query where I can show the positive and negative future changes of the articles. For example: select art.id, art.name, art.actual_stock, art.min_stock, change.stock_change, change.date from change left join art on art.id = change.art_id order by art.id, change.id Ok, I have a lis