Re: [GENERAL] Automating databse creation

2007-02-09 Thread Shoaib Mir
Yes, you can pass values to the scripts. Here is an example Suppose the script file 'test.sql' is like this: insert into test values (:chk1 , :chk2); Now you can pass the variables using psql as: psql -d test -U postgres -v chk1=5 -v chk2='abc' -f test.sql Hope that helps... -- Shoaib

[GENERAL] intarray index vs gin index

2007-02-09 Thread Marek Lewczuk
Hello, I'm trying to update my database to 8.2 version and have some problems with intarray module. As far I know PG 8.2 contains many features that are contained within intarray - indexing array fields (using gin), operators etc. Currently (in PostgreSQL 8.1) I'm using intarray not only for

[GENERAL] does anyone have a tool to convert SP'sT-SQL to Postgres

2007-02-09 Thread johnf
Hi, I'm hoping someone has already taken the time to write a routine (in some language - python,perl, etc..) to convert MS SQL T-SQL stored procedures into Postgres PL/pgSQL. And of course they are willing to share. Thanks -- John Fabiani ---(end of

[GENERAL] Automating databse creation

2007-02-09 Thread Ashish Karalkar
Hello list, I want to automate database creation, user creation,table creation via script. this script will be run by an external programme to postgresql server. is there any way? what i want to do is as follows: #!/bin/sh su - postgres TIMEDUMP=`date +%Y%m%d_%H%M`

Re: [GENERAL] does anyone have a tool to convert SP'sT-SQL to Postgres

2007-02-09 Thread A. Kretschmer
am Thu, dem 08.02.2007, um 21:28:08 -0800 mailte johnf folgendes: Hi, I'm hoping someone has already taken the time to write a routine (in some language - python,perl, etc..) to convert MS SQL T-SQL stored procedures into Postgres PL/pgSQL. And of course they are willing to share. See

[GENERAL] trigger for pg_authid

2007-02-09 Thread Diego de Blas
Hello, I'm trying to set a new trigger for pg_authid connected as postgres but system returns always the same error Permission denied: pg_authid is a system catalog... I have checked privileges and I can teorically add new triggers. I don't know whta's wrong... Thanks

Re: [GENERAL] Automating databse creation

2007-02-09 Thread Thomas Pundt
Hi, On Friday 09 February 2007 08:53, Ashish Karalkar wrote: | I want to automate database creation, user creation,table creation via | script. this script will be run by an external programme to postgresql | server. is there any way? | | what i want to do is as follows: | | | #!/bin/sh | | su -

Re: [GENERAL] Automating databse creation

2007-02-09 Thread Bruce McAlister
Hi Ashish Karalkar That's because the shell is waiting for input. Try do something like this su - postgres -c ${PG_PATH}/pg_dump -d qsweb -U postgres -p 5432 -Ft -f /usr/local/pgsql/data/backup/BACKUP_QSWEB_${TIMEDUMP}.tar That should run the command as the postgres user.

Re: [GENERAL] Possibly odd question; diff results?

2007-02-09 Thread Merlin Moncure
On 2/8/07, Madison Kelly [EMAIL PROTECTED] wrote: Hi all, I've got a 'history' schema that records changes in the public schema tables over time. I use a trigger and function to do this. What I would like to do though, and this may not even be possible, is say something like (pseudo-code)

Re: [GENERAL] trigger for pg_authid

2007-02-09 Thread Andreas Kretschmer
Diego de Blas [EMAIL PROTECTED] schrieb: Hello, I'm trying to set a new trigger for pg_authid connected as postgres but system returns always the same error Permission denied: pg_authid is a system catalog... I have checked privileges and I can teorically add new triggers. I don't know

Re: [GENERAL] intarray index vs gin index

2007-02-09 Thread Teodor Sigaev
intarray. My question is whether I still should use intarray for indexing (if yes then either I should use GIST or GIN) or maybe GIN index is faster than GIST+intarray / GIN+intarray. Yes, with intarray you can use GiST/GIN indexes which you wish -- Teodor Sigaev

Re: [GENERAL] trigger for pg_authid

2007-02-09 Thread Kenneth Downs
Diego de Blas wrote: Hello, I'm trying to set a new trigger for pg_authid connected as postgres but system returns always the same error Permission denied: pg_authid is a system catalog... I have checked privileges and I can teorically add new triggers. I don't know whta's wrong... Thanks

Re: [GENERAL] does anyone have a tool to convert SP'sT-SQL to Postgres

2007-02-09 Thread johnf
On Friday 09 February 2007 04:43, A. Kretschmer wrote: am Thu, dem 08.02.2007, um 21:28:08 -0800 mailte johnf folgendes: Hi, I'm hoping someone has already taken the time to write a routine (in some language - python,perl, etc..) to convert MS SQL T-SQL stored procedures into Postgres

Re: [GENERAL] Modifying a foreign key constraint?

2007-02-09 Thread Marc Branchaud
Whoops, ALTER TABLE foo ADD FOREIGN KEY (foo_bar_id_fkey) REFERENCES bar(id) ON DELETE CASCADE; should be ALTER TABLE foo ADD FOREIGN KEY (bar_id) REFERENCES bar(id) ON DELETE CASCADE; Sorry! Marc ---(end of broadcast)---

[GENERAL] Modifying a foreign key constraint?

2007-02-09 Thread Marc Branchaud
What's the best way to modify a foreign key constraint? I need to change a foreign key from ON DELETE NO ACTION to ON DELETE CASCADE. Should I just drop the constraint and re-add it? For example: ALTER TABLE foo DROP CONSTRAINT foo_bar_id_fkey; ALTER TABLE foo ADD FOREIGN KEY

Re: [GENERAL] Adding TEXT columns tanks performance?

2007-02-09 Thread Merlin Moncure
On 2/8/07, Arturo Perez [EMAIL PROTECTED] wrote: Hi all, Saturday I changed a table to add a varchar(24) and a TEXT column. It's used for some reporting purposes (small potatoe stuff really) and the TEXT column remains mostly empty. However, this week performance has gotten terrible. Queries

Re: [GENERAL] Possibly odd question; diff results?

2007-02-09 Thread Madison Kelly
Merlin Moncure wrote: On 2/8/07, Madison Kelly [EMAIL PROTECTED] wrote: Hi all, I've got a 'history' schema that records changes in the public schema tables over time. I use a trigger and function to do this. What I would like to do though, and this may not even be possible, is say

[GENERAL] Some unknown error in a function

2007-02-09 Thread Jasbinder Singh Bali
Hi Following is the script of my plpgsql function CREATE OR REPLACE FUNCTION sp_insert_tbl_vrfy_mx(int4,text, text, inet, text, text) RETURNS void AS$$ DECLARE sequence_no int4; BEGIN SELECT INTO sequence_no MAX(seq_no) FROM tbl_verify_mx WHERE unmask_id = $1; IF

Re: [GENERAL] Modifying a foreign key constraint?

2007-02-09 Thread Richard Broersma Jr
ALTER TABLE foo DROP CONSTRAINT foo_bar_id_fkey; ALTER TABLE foo ADD FOREIGN KEY (foo_bar_id_fkey) REFERENCES bar(id) ON DELETE CASCADE; Is there a more compact way to do this, perhaps with a single ALTER TABLE command? Sure there is, you can preform multiple alterations in one

Re: [GENERAL] Some unknown error in a function

2007-02-09 Thread Tom Lane
Jasbinder Singh Bali [EMAIL PROTECTED] writes: I run this function using select sp_insert_tbl_vrfy_mx(55,'jas','xyz.com','192.168.0.105', ' mail.xyz.com,'mxrecoredmxjdlkfjdk') and get the following error:- CONTEXT: SQL statement SELECT $1 =' ' PL/pgSQL function sp_insert_tbl_vrfy_mx

Re: [GENERAL] Some unknown error in a function

2007-02-09 Thread Chandra Sekhar Surapaneni
IF $4 = ' ' THEN Here ' ' is not a valid inet value. If you really want to check to see if the inet value is null, you can cast it to text and compare it. For example: IF text('$4') = '' Then That will fix your issue. -Chandra Sekhar Surapaneni From:

Re: [GENERAL] Postgres SQL Syntax

2007-02-09 Thread Merlin Moncure
On 2/2/07, Jim C. [EMAIL PROTECTED] wrote: Besides what Tom says, '0' is a string, not an integer. PG takes it, but it's a bad habit. Maybe it is and maybe it isn't. I wouldn't know. I'm merely the unfortunate soul chosen to convert this from MySQL to Postgres. :-/ I've been working on it

Re: [GENERAL] Modifying a foreign key constraint?

2007-02-09 Thread Marc Branchaud
Richard Broersma Jr wrote: Sure there is, you can preform multiple alterations in one statement: ALTER TABLE foo DROP CONSTRAINT foo_bar_id_fkey, ADD CONSTRAINT foo_bar_id_fkey FOREIGN KEY (bar_fkey) REFERENCES bar (id) ON DELETE

Re: [GENERAL] Modifying a foreign key constraint?

2007-02-09 Thread Richard Broersma Jr
I was wondering if there might be something along the lines of an ALTER CONSTRAINT clause, which could change a specific aspect of a constraint without having to re-specify the whole thing. As you see from this link: http://www.postgresql.org/docs/8.2/interactive/sql-commands.html There is

Re: [GENERAL] ldap auth problem

2007-02-09 Thread Brian Wong
On 1/2/07, Ing. Dan Horáček [EMAIL PROTECTED] wrote: Hi, I've just installed postgres 8.2.0-1 for win32 and wanted to try out the built-in LDAP support(with Openldap and Novell eDirectory). The following LDAP authentication was added to pg_hba.conf : Openldap: host all all

Re: [GENERAL] Postgres SQL Syntax

2007-02-09 Thread Ted Byers
- Original Message - From: Merlin Moncure [EMAIL PROTECTED] the open standard to convert data from one database to another, unfortunately, is SQL. SQL is incomplete, illogical, and obscure, so here we are. The same can be said about any programming language, can it not? Even

Re: [GENERAL] Postgres SQL Syntax

2007-02-09 Thread Joshua D. Drake
Ted Byers wrote: - Original Message - From: Merlin Moncure [EMAIL PROTECTED] the open standard to convert data from one database to another, unfortunately, is SQL. SQL is incomplete, illogical, and obscure, so here we are. The same can be said about any programming language, can

[GENERAL] bytea characteristics

2007-02-09 Thread jws
Are there any known guidelines regarding storing images in a bytea column vs simply storing the meta-data? Do the images take up a certain percentage more space due to the on- disk format when stored this way? ---(end of broadcast)--- TIP 2: Don't