Re: [GENERAL] database name aliases?

2006-11-07 Thread Albe Laurenz
Reece Hart wrote: > I'd like to be able to have several versions of a database > available concurrently and one database alias that refers to > the most recent of these. For example: > > dbname_1-1 > dbname_1-2 > dbname_1-3 > dbname -> dbname_1-3 > > and > $ psql -d dbname > would connect to d

Re: [GENERAL] R and postgres

2006-11-07 Thread Joe Conway
Reece Hart wrote: I'd like to get R to talk to postgresql, but my head's spinning among a web of broken links, way outdated web pages, project deprecation announcements and a terrible signal:link ratio. Rdbi and RdbiPgSQL seem to be the answer, despite both being apparently defunct projects.

Re: [GENERAL] stored procedure / Function

2006-11-07 Thread Alban Hertroys
Alain Roger wrote: Hi, How to retrieve the IN parameter of a function for later use ? i tried this : CREATE OR REPLACE FUNCTION "public"."SP_U_001" ("TypeOfArticle" varchar) RETURNS SETOF "public"."active_articles" AS My advice: Don't quote your identifiers unless you really really want the

Re: [GENERAL] FOR ... IN

2006-11-07 Thread Alban Hertroys
Alain Roger wrote: Hi, Before (in version 8.0.1), i did the following thing and it was working well...now (in version 8.1.4) it seems that it does not work anymore... problem is with FOR rec IN loop... Could you elaborate on "does not work"? So how can i tell "FOR all RECORDS from select * f

Re: [GENERAL] Header meaning for pg_dump

2006-11-07 Thread Martijn van Oosterhout
On Tue, Nov 07, 2006 at 08:40:54AM +0700, Premsun Choltanwanich wrote: > Dear Richard, > > Regarding the information you give to me, I understand that this > information is a thing that normally used by PostgreSQL system. And > the information seem to be placed on a comment area. So, Who need to

Re: [GENERAL] Dump all databases to corresponding files

2006-11-07 Thread Tomasz Ostrowski
On Mon, 06 Nov 2006, Roman Neuhauser wrote: > # [EMAIL PROTECTED] / 2006-11-06 12:26:43 +0100: > > On Sun, 05 Nov 2006, CSN wrote: > > > > > Anybody know of a script that dumps all databases into > > > corresponding dump files > > > > I've written this one in bash: > > [snip] > > This would brea

Re: [GENERAL] FOR ... IN

2006-11-07 Thread William Leite Araújo
2006/11/6, Alain Roger <[EMAIL PROTECTED]>: Hi,Before (in version 8.0.1), i did the following thing and it was working well...now (in version 8.1.4) it seems that it does not work anymore...problem is with FOR rec IN loop...So how can i tell "FOR all RECORDS from select * from articles, articletype

[GENERAL] X.50x OID representation

2006-11-07 Thread redhog
I need to save something very similar to X.50x IOD:s, that is, paths where the path-components are numbers. For example: 10.5.5003.24.35. Futhermore, I need to sort these in numerical path order, so that if two paths are compared according to the first path component that differs, and this path co

Re: [GENERAL] X.50x OID representation

2006-11-07 Thread Martijn van Oosterhout
On Tue, Nov 07, 2006 at 03:57:43AM -0800, redhog wrote: > I need to save something very similar to X.50x IOD:s, that is, paths > where the path-components are numbers. For example: 10.5.5003.24.35. Looks like something for ltree, which is a datatype for storing tree-structured data. http://projec

Re: [GENERAL] database name aliases?

2006-11-07 Thread Woody Woodring
We use the pg_services.conf file.   http://www.postgresql.org/docs/8.1/static/libpq-pgservice.html   In the file you can point the alias to whatever db you want.  To connect:   [bash]$ PGSERIVCE=dbname psql   Woody IGLASS Networks From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf O

[GENERAL] when to use pfree?

2006-11-07 Thread Ron Peterson
I just encountered a problem with a C function I've been working on where it broke with the error: could not find block containing chunk ... I tracked the problem down to my use of pfree. Apparently my function was not happy attempting to return a result that was built using values that had been

Re: [GENERAL] when to use pfree?

2006-11-07 Thread Ron Peterson
On Tue, Nov 07, 2006 at 08:36:45AM -0500, Ron Peterson wrote: > I just encountered a problem with a C function I've been working on > where it broke with the error: > > could not find block containing chunk ... > > I tracked the problem down to my use of pfree. I narrowed the problem down a lit

Re: [GENERAL] when to use pfree?

2006-11-07 Thread Tom Lane
Ron Peterson <[EMAIL PROTECTED]> writes: > char* > tp2cp_palloc( char* stringp, const text* textp ) { >int len; >len = VARSIZE(textp) - VARHDRSZ; >stringp = (char*)palloc( len + 1 ); >if( ! memcpy( stringp, VARDATA(textp), len ) ) { return NULL; } >if( ! memset( stringp + len, '

Re: [GENERAL] R and postgres

2006-11-07 Thread TJ O'Donnell
I use RODBC which is available from http://cran.r-project.org/ I'm not sure if this will do what you want, or whether it has the features of Rdbi you need, but it gets the job done for me. I can open a "channel", execute a SQL statement (typically a Select) and read the results back into a R dataf

Re: RE : Re: [GENERAL] first steps in PhP and PostgreSQL

2006-11-07 Thread Ben
No, that's the access log. Check the error log. On Tue, 7 Nov 2006, Desmond Coughlan wrote: X-No-Archive: true Yep... 192.168.0.254 - - [07/Nov/2006:10:12:57 +0100] "GET /php_experimental/base.php HTTP/1.1" 200 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" D. Ben <[EMAIL PR

Re: [GENERAL] FOR ... IN

2006-11-07 Thread William Leite Araújo
2006/11/7, Alain Roger <[EMAIL PROTECTED]>: but there is already a RETURN NEXT res;so what will be the point of this RETURN after the END LOOP; ?http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-structures.html -- William Leite Araújo

Re: [GENERAL] FOR ... IN

2006-11-07 Thread Alain Roger
Hi William,i've read that RETURN should be used when function does not return a set. in my case, i return a set. so i can not write twice return.Here is my latest version of my function.-- Function: SP_U_001(typeofarticle varchar) -- DROP FUNCTION SP_U_001(typeofarticle varchar);CREATE OR REPLACE F

Re: [GENERAL] EXECUTE INSERT BUGS?

2006-11-07 Thread Jeff Davis
On Tue, 2006-11-07 at 00:01 -0500, Tom Lane wrote: > Jeff Davis <[EMAIL PROTECTED]> writes: > > On Mon, 2006-11-06 at 16:40 -0800, Matthew Peter wrote: > >> v_value text := null; > >> -- ^^^ right here, NULL makes the querystring fail by setting cmd = > >> null > >> BEGIN > >> cmd := 'INSERT INTO t

[GENERAL] running external programs

2006-11-07 Thread km
Hi all, Is it possible in a PLSQL function to call an external program/script residing at /usr/bin and return the result ? are there any workarounds for this sort of a problem ? regards, KM ---(end of broadcast)--- TIP 2: Don't 'kill -9' the p

Re: [GENERAL] running external programs

2006-11-07 Thread Andreas Kretschmer
km <[EMAIL PROTECTED]> schrieb: > > Hi all, > > Is it possible in a PLSQL function to call an external program/script > residing at /usr/bin and return the result ? No, because plsql is a trusted language. You can't run external commands from such a language. > > are there any workarounds

Re: [GENERAL] database name aliases?

2006-11-07 Thread Jeff Davis
On Mon, 2006-11-06 at 19:58 -0800, Reece Hart wrote: > On Mon, 2006-11-06 at 16:43 -0800, Jeff Davis wrote: > > You can use "ALTER DATABASE name RENAME TO newname;". Does that > > help? > > This is what I do now to evolve from development to staging to > production, as well as to deprecate version

Re: [GENERAL] database name aliases?

2006-11-07 Thread Reece Hart
Woody and Albe- I wasn't aware of pg_service -- that does solve my original problem. Thanks for the replies. -Reece -- Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0

Re: [GENERAL] running external programs

2006-11-07 Thread Bill Moran
In response to Andreas Kretschmer <[EMAIL PROTECTED]>: > > are there any workarounds for this sort of a problem ? > > Yes, with untrusted languages like plperlU or plsh or other. You can also write your own stored procedures that duplicate the functionality of the external program ... assuming y

Re: [GENERAL] running external programs

2006-11-07 Thread Tony Caduto
km wrote: Hi all, Is it possible in a PLSQL function to call an external program/script residing at /usr/bin and return the result ? are there any workarounds for this sort of a problem ? regards, KM You can do it with a PLperl function. You would have to use the untrusted PLperlu th

Re: [GENERAL] running external programs

2006-11-07 Thread km
> > Is it possible in a PLSQL function to call an external program/script > > residing at /usr/bin and return the result ? > > No, because plsql is a trusted language. > You can't run external commands from such a language. Is that a deciding criteria for a language to be flagged trusted or not

Re: [GENERAL] running external programs

2006-11-07 Thread Uwe C. Schroeder
On Tuesday 07 November 2006 10:55, km wrote: > > > Is it possible in a PLSQL function to call an external program/script > > > residing at /usr/bin and return the result ? > > > > No, because plsql is a trusted language. > > You can't run external commands from such a language. > > Is that a decid

Re: [GENERAL] per-row security

2006-11-07 Thread Andrew Sullivan
On Mon, Nov 06, 2006 at 01:40:18PM -0800, Marc Munro wrote: > You will of course be replicating the underlying tables and not the > views, so your replication user will have to have full access to the > unsecured data. This is natural and should not be a concern but may be > worth explicitly docum

[GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Alain Roger
Hi,I' still with my stored procedure :-- Function: SP_U_001(typeofarticle varchar)-- DROP FUNCTION SP_U_001(typeofarticle varchar);CREATE OR REPLACE FUNCTION SP_U_001(IN typeofarticles VARCHAR)   RETURNS SETOF active_articles AS$BODY$DECLARE    myrec RECORD;    res active_articles;/

[GENERAL] WAL ends before end time of backup dump

2006-11-07 Thread Jeff Davis
Version: 8.1.4 I am having a problem restoring one of my base backups. I took a successful backup of the production DB already since this one, and this is just a routine test, so it's fortunately not an emergency. I think that I either have a corrupted base backup or corrupted WAL segments, or ma

Re: [GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Merlin Moncure
On 11/7/06, Alain Roger <[EMAIL PROTECTED]> wrote: Hi, I' still with my stored procedure : -- Function: SP_U_001(typeofarticle varchar) -- DROP FUNCTION SP_U_001(typeofarticle varchar); CREATE OR REPLACE FUNCTION SP_U_001(IN typeofarticles VARCHAR) RETURNS SETOF active_articles AS $BODY$ DE

Re: [GENERAL] [HACKERS] Tsearch Index Size and GiST vs. GIN

2006-11-07 Thread Jeff Davis
On Mon, 2006-11-06 at 13:14 -0600, Richard Whidden wrote: > Due to popular demand (1 person), I've compared sizes with 90 and 100 > fillfactors, along with using the new GIN index. > > Findings were not surprising, except for the GIN indexes, which doubled in > size. > This is how I understand

Re: [GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Alain Roger
If i do what you wrote, i can not create the function into my DB.error on 1st ( On 11/7/06, Merlin Moncure < [EMAIL PROTECTED]> wrote:On 11/7/06, Alain Roger < [EMAIL PROTECTED]> wrote:> Hi,>> I' still with my stored procedure :>> -- Function: SP_U_001(typeofarticle varchar)>> -- DROP FUNCTION SP_U

Re: [GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Stephan Szabo
On Tue, 7 Nov 2006, Alain Roger wrote: > Hi, > > I' still with my stored procedure : > > -- Function: SP_U_001(typeofarticle varchar) > > -- DROP FUNCTION SP_U_001(typeofarticle varchar); > > CREATE OR REPLACE FUNCTION SP_U_001(IN typeofarticles VARCHAR) > RETURNS SETOF active_articles AS > $BO

Re: [GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Alain Roger
i already tried this possibility and i've got :ERROR:  set-valued function called in context that cannot accept a setCONTEXT:  PL/pgSQL function "sp_u_001" line 26 at return next:-( On 11/7/06, Stephan Szabo <[EMAIL PROTECTED]> wrote: On Tue, 7 Nov 2006, Alain Roger wrote:> Hi,>> I' still with my s

Re: [GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Alain Roger
Ok guys...i found the stupid problem :-((everytime that i call my stored procedure, i did like that : select sp_u_001('action'); instead of  select * from sp_u_001('action');thanks to all of you for your tips, they helped me to understand composite. one last question : how can i test if myrec compo

Re: [GENERAL] X.50x OID representation

2006-11-07 Thread redhog
> Looks like something for ltree, which is a datatype for storing > tree-structured data. > > http://projects.commandprompt.com/public/pgsql/browser/trunk/pgsql/contrib/ltree/README.ltree Unfourtunately, ltree seems to compare node labels in lexicographic order: "have their usual meanings. Compa

[GENERAL] Out of town next week

2006-11-07 Thread Joshua D. Drake
Hello, I will be teaching another class in Kentucky next week. I will only be sporadically checking email during the day (but will be at night). Joshua D. Drake -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Provi

Re: [GENERAL] per-row security

2006-11-07 Thread Christopher Browne
[EMAIL PROTECTED] (Andrew Sullivan) wrote: > On Mon, Nov 06, 2006 at 01:40:18PM -0800, Marc Munro wrote: >> You will of course be replicating the underlying tables and not the >> views, so your replication user will have to have full access to the >> unsecured data. This is natural and should not

Re: [GENERAL] R and postgres

2006-11-07 Thread Reece Hart
On Tue, 2006-11-07 at 00:22 -0800, Joe Conway wrote: I think you want this: http://bioconductor.org/packages/1.9/bioc/html/RdbiPgSQL.html The bioconductor project is now maintaining RdbiPgSQL. I think many people also use RODBC to connect R with Postgres. Joe- I almost

Re: [GENERAL] WAL ends before end time of backup dump

2006-11-07 Thread Tom Lane
Jeff Davis <[EMAIL PROTECTED]> writes: > LOG: restored log file "00010017002B" from archive > LOG: record with zero length at 17/2B6EACC8 > LOG: redo done at 17/2B6EAC84 It looks to me like you archived this log file before it was fully written. You should take a close look at your

Re: [GENERAL] WAL ends before end time of backup dump

2006-11-07 Thread Jeff Davis
On Tue, 2006-11-07 at 11:15 -0800, Jeff Davis wrote: > Version: 8.1.4 > [ snip ] > OG: restored log file "00010017002B" from archive > LOG: record with zero length at 17/2B6EACC8 > LOG: redo done at 17/2B6EAC84 > LOG: restored log file "00010017002B" from archive > LO

Re: [GENERAL] WAL ends before end time of backup dump

2006-11-07 Thread Jeff Davis
On Tue, 2006-11-07 at 17:20 -0500, Tom Lane wrote: > Jeff Davis <[EMAIL PROTECTED]> writes: > > LOG: restored log file "00010017002B" from archive > > LOG: record with zero length at 17/2B6EACC8 > > LOG: redo done at 17/2B6EAC84 > > It looks to me like you archived this log file bef

[GENERAL] converting Informix outer to Postgres

2006-11-07 Thread gurkan
Hi all, I have been working on this Informix SQL query which has an outer join. I have attached Informix query and my "supposedly" solution to this query but I cannot get the same count. I appreciate for any help. Thanks. --Informix query select count(u.id) from user u, invention i, inv_contracts

[GENERAL] Stable sort?

2006-11-07 Thread redhog
Is sorting in PostgreSQL stable over subqueries, that is, is select * from (select * from A order by x) as B order by y; equivalent with select * from A order by y, x; ? ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

[GENERAL] Question on inserting and querying at the same time.

2006-11-07 Thread Wei Weng
I have a database table that has about 90k entries, they are all straightfoward text, and there is only one ID field that I use as primary key for this table. I have two threads working on this table. One of them inserting new content constantly, (about every second) another one idles and only wak

Re: [GENERAL] Stable sort?

2006-11-07 Thread Ron Mayer
redhog wrote: > Is sorting in PostgreSQL stable over subqueries, that is, is > > select * from (select * from A order by x) as B order by y; > > equivalent with > > select * from A order by y, x; Seems as easy to try as to guess. If I did this query right, it seems not. select * from (select

[GENERAL] A couple more PostgreSQL C questions

2006-11-07 Thread Ron Peterson
I have a couple of more PostgreSQL C questions, about the following two compiler warnings: warning: ISO C90 forbids mixed declarations and code This appears to be caused by the following statement: text* rand_dev = PG_GETARG_TEXT_P(0); in

Re: [GENERAL] A couple more PostgreSQL C questions

2006-11-07 Thread Ron Peterson
On Tue, Nov 07, 2006 at 07:50:52PM -0500, Ron Peterson wrote: > I have a couple of more PostgreSQL C questions, about the following two > compiler warnings: > > warning: ISO C90 forbids mixed declarations and code I'm thinking this is unavoidable, and unless my time machine starts working, irrele

Re: [GENERAL] A couple more PostgreSQL C questions

2006-11-07 Thread Tom Lane
Ron Peterson <[EMAIL PROTECTED]> writes: > Datum > y_somefunc ( PG_FUNCTION_ARGS ) > { >if( PG_ARGISNULL(0) || >PG_ARGISNULL(1) || >PG_ARGISNULL(2) ) >{ > PG_RETURN_NULL(); >} >text* rand_dev = PG_GETARG_TEXT_P(0); >... > Should I be concerned by this? Wh

Re: [GENERAL] Per-row security

2006-11-07 Thread Gurjeet Singh
On 11/4/06, Alexander Staubo <[EMAIL PROTECTED]> wrote: I am designing an application which requires fine-grained role-basedsecurity, where every logical object in the system has an ACL whichexpresses the permissions allowed by roles. Have you considered viel for Postgres ()? Here's what it says in

Re: [GENERAL] [ADMIN] Is there anyway to...

2006-11-07 Thread Jim C. Nasby
Moving to -general (and please start a new thread instead of hijacking an existing one). On Thu, Nov 02, 2006 at 01:14:22PM -0500, louis gonzales wrote: > Hello all, > Is there an existing mechanism is postgresql that can automatically > increment/decrement on a daily basis w/out user interaction

[GENERAL] delete performance is extremely slow

2006-11-07 Thread surabhi.ahuja
I am using postgresql 8.0.0   i have 4 tables a, b, c, d. with foreign key constraints. between table b and a between c and b and between d and c   I am doing delete from a   the total number of rows in table a is around 10 table b is around 20, similarly table c has around 20. table d however

Re: [GENERAL] delete performance is extremely slow

2006-11-07 Thread Alan Hodgson
On Tuesday 07 November 2006 22:59, "surabhi.ahuja" <[EMAIL PROTECTED]> wrote: > I am using postgresql 8.0.0 > > i have 4 tables a, b, c, d. > with foreign key constraints. > between table b and a > between c and b > and between d and c > > I am doing delete from a > > delete from a is taking so lo

Re: [GENERAL] R and postgres

2006-11-07 Thread Joe Conway
Reece Hart wrote: On Tue, 2006-11-07 at 00:22 -0800, Joe Conway wrote: I think you want this: http://bioconductor.org/packages/1.9/bioc/html/RdbiPgSQL.html The bioconductor project is now maintaining RdbiPgSQL. I think many people also use RODBC to connect R with Postgres. I almost sent you