Re: [SQL] Use "CREATE USER" in plpgsql function

2010-09-15 Thread Asko Oja
And dynamic SQL leads easily to SQL injection so quoting is required there. execute 'create user ' || quote_ident(i_username) || ' password ' || quote_literal(i_password); On Wed, Sep 15, 2010 at 5:26 PM, Igor Neyman wrote: > > > > -Original Message- > > From: Tatarnikov Alexand

Re: [SQL] Object create date

2008-12-31 Thread Asko Oja
Hi About three years ago we started doing nightly schema dumps of all our databases and then updating these into CVS. That has proven to be pretty useful when there is need to determine when some change was done in database. regards, Asko On Tue, Dec 30, 2008 at 7:33 PM, Erik Jones wrote: > >

[SQL] How can this be legal syntax

2008-12-16 Thread Asko Oja
I was quite amazed to find that this piece of code actually works while reviewing code. I would prefer if it gave an error :) test=# create or replace function test(i_input text) returns text as $$ declare result text; begin SELECT CASE WHEN lower(i_input) ~ '^[a-z]' THEN '

Re: [SQL] select across two database

2008-06-16 Thread Asko Oja
Helo it is possible if you don't mind some work :) We are doing it with plproxy. Simple scenario would be 1. install plproxy 2. create sql functon with needed sql in remote db 3. create plproxy function in current db 4. create sql or function that combines the results from data in current db and p

Re: [SQL] Backup Database

2007-11-05 Thread Asko Oja
Hi We do it with Skytools. In addition to replication with Londiste it hs lot's of other useful scripts for keeping online database small and healthy. Asko On 10/31/07, Joanne Salerno <[EMAIL PROTECTED]> wrote: > > I have two Postgres databases (7.4 and 8.24) within the same network on > LINUX

Re: [SQL] Database normalization

2007-08-28 Thread Asko Oja
Hi I would create one table to log updates with type field and one id filed that contains either client id or service id according to type. On such a table i would forget about foreign keys (thay are better to be avoided anyway if you have millions of records in tables). That way you can share cod