Re: [GENERAL] Postgresql replication

2005-08-26 Thread William Yu
Chris Travers wrote: Why not have the people who have rights to review this all write to the master database and have that replicated back? It seems like latency is not really an issue. Replication here is only going to complicate What master database? Having a single master defeats the

Re: [GENERAL] Altering built-in functions cast

2005-08-26 Thread Richard Huxton
Matt A. wrote: Anyone know how I could alter the cast of the nullif() function directly to return INT? We use NULLIF() for adding [1|0|null] according to the evalution of nullif('x','') into integer columns. Where x is an integer and sometimes a empty string, which if it's an empty string

Re: [GENERAL] regarding threads and transactions - problem 2

2005-08-26 Thread Martijn van Oosterhout
On Fri, Aug 26, 2005 at 01:28:51PM +0530, Surabhi Ahuja wrote: Dear All, This is in reference to a problem which I had put up sometime back. Please take some time to study it The piece of code that i am trying to execute is attached (itsa cpp file) The stored procedure (that the

Re: [GENERAL] regarding threads and transactions - problem 2

2005-08-26 Thread Richard Huxton
Surabhi Ahuja wrote: BEGIN patKey := $4; select patient_id into patId from patient where patient_key = patKey; if not found THEN insert into patient(patient_name,org_pat_id,birth_date,patient_key) values($1,trim($2),$3,$4); The output that i

Re: [GENERAL] Altering built-in functions cast

2005-08-26 Thread Matt A.
Thank you so much for the reply. I inserted the function as you said in pgsql. I tried testing it and got... PERFECT RESULTS! THAAANKKK YOUUU! *kisses feet* j/k But honestly, Thank you very much. You saved me from suicide. --- Richard Huxton

[GENERAL] Serials jumping

2005-08-26 Thread Matt A.
I have a serial column on a test box DB. I'm using select nextval('some_seq') as id to insert a id in sequence. It doesn't return the next value but at least 4 or so (random) ahead of the current value. Is this to be expected? Is this the most efficient way to retreive an id value for insert a

Re: [GENERAL] Serials jumping

2005-08-26 Thread Richard Huxton
Matt A. wrote: I have a serial column on a test box DB. I'm using select nextval('some_seq') as id to insert a id in sequence. It doesn't return the next value but at least 4 or so (random) ahead of the current value. Is this to be expected? Quite possibly. The sequence generator doesn't skip

Re: [GENERAL] unsubscribe

2005-08-26 Thread Terry Lee Tucker
I tried that, but it didn't work ;o) On Friday 26 August 2005 01:11 am, [EMAIL PROTECTED] saith: On Thu, Aug 25, 2005 at 07:30:07AM +0800, Richard Sydney-Smith wrote: unsubscribe Here's how to unsubscribe: First, ask your Internet Provider to mail you an Unsubscribing Kit. Then follow

[GENERAL] Is there going to be a 8.1 beta for win32?

2005-08-26 Thread Tony Caduto
Is there going to be a 8.1 beta for win32? Thanks, P.S. I did find the 8.1 beta docs, it took a little searching on google. http://developer.postgresql.org/docs/postgres/ -- Tony Caduto http://www.amsoftwaredesign.com Home of PG Lightning Admin for Postgresql 8.x

[GENERAL] postgres optimizer

2005-08-26 Thread Hossein S. Attar
Hi: I am working on postgres optimizer code to add some statistics collection features for an academic project. At some point in my work, I need to be able to tell if a join is a foreign key join or not. Also in case of a foreign key join, I need to identify which input to the join operator

[GENERAL] copy command feature requests

2005-08-26 Thread Johan Wehtje
Whilst there is so much attention on the copy command it might be a good time to chime in with some of the features that it would be nice for copy to support, as I have run into it's limitations on a number of projects were the bulk loading of CSV files are a requirement. 1. I would love there

Re: [GENERAL] Postgresql replication

2005-08-26 Thread Chris Travers
William Yu wrote: This system sounds ok for documents and general data that can always be revived via version control/history. But I can't see how this would work for financial transactions where you're dealing with money and bank accounts. Suppose I have $100 in my account. I decided to

[GENERAL] Resore PG-Data from Files after crash

2005-08-26 Thread tomtailor
Hi! I've the following Problem and hope someone can help me. My PostgreSQL Database were running on a Debian Linux. Some day the OS crahsed and - here's the Problem - there is no dump file from Database. But I still have the files in base, global, pg_clog. So I did a fresh setup and copied the

Re: [GENERAL] Resore PG-Data from Files after crash

2005-08-26 Thread Martijn van Oosterhout
On Thu, Aug 25, 2005 at 08:56:40AM -0700, [EMAIL PROTECTED] wrote: Hi! I've the following Problem and hope someone can help me. My PostgreSQL Database were running on a Debian Linux. Some day the OS crahsed and - here's the Problem - there is no dump file from Database. But I still have the

[GENERAL] bytea or large objects?

2005-08-26 Thread Howard Cole
Hi, I am going to create binary objects in a database which are compressed eml files (1K - 10 Mbytes in size). Am I better using the bytea or large objects? Is there still an issue with backup and restore of databases using large objects with pg_dump/restore? Thanks in advance. Howard

Re: [GENERAL] Is there going to be a 8.1 beta for win32?

2005-08-26 Thread Magnus Hagander
Is there going to be a 8.1 beta for win32? I assume you are talking about a binary version. The source version is already available. Yes, there is. But we're not quite ready yet, so it'll be a few days before it'll be out. Until then you can use the source version if youh ave the tools required

Re: [GENERAL] Is there going to be a 8.1 beta for win32?

2005-08-26 Thread Tony Caduto
Thanks Magnus, yes by default I meant binary since that is how the majority of win32 software is distributed. I am a Delphi programmer, so I will wait for the binary installer to be released :-) Thanks again for the info. Tony Is there going to be a 8.1 beta for win32? I assume you

Re: [GENERAL] Problems Reinstalling PostgreSQL on XP

2005-08-26 Thread Magnus Hagander
It appears to die in CheckAvailableDLLs(). See question 3.1 in the FAQ at http://www.postgresql.org/docs/faqs.FAQ_windows.html. //Magnus -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Trewern Sent: Friday, August 26, 2005 4:58 PM To:

Re: [GENERAL] postgres optimizer

2005-08-26 Thread Tom Lane
Hossein S. Attar [EMAIL PROTECTED] writes: I am working on postgres optimizer code to add some statistics collection features for an academic project. At some point in my work, I need to be able to tell if a join is a foreign key join or not. Also in case of a foreign key join, I need to

[GENERAL] TG_OP and undefined OLD values

2005-08-26 Thread Mike Nolan
I'm trying to write some code in a trigger that fires on both an insert and an update. At one point I need to update a column either on an insert or if the value of the column has changed. The following code fails because the OLD value is not defined: if TG_OP = ''INSERT'' or (TG_OP =

Re: [GENERAL] help

2005-08-26 Thread Bruno Wolff III
On Fri, Aug 26, 2005 at 01:41:12 -0700, All I need is integer columns evaluting in a nullif('1','') returns int = 1 nullif('','') returns int = null nullif('0','') returns int = 0 fashion upon inserting to an INTEGER column. Forget booleans. Forget text. Just integers. Is this

Re: [GENERAL] Resore PG-Data from Files after crash

2005-08-26 Thread Tom Lane
[EMAIL PROTECTED] writes: Starting PostgreSQL database server: postmaster(FAILED) ERROR: There is no PostgreSQL database framework in /srv/postgres/data. Run initdb as the postgres user to create it There is no such error string in Postgres proper -- I suppose the complaint is coming from

Re: [GENERAL] Postgresql replication

2005-08-26 Thread Carlos Henrique Reimer
Hi, IĀ“mthinking to test your suggestion, basically because there are only few sites to connect, but there are some points that arenĀ“t very clear to me. My doubts: 1. How to make a view updatable? Using the rule system? 1. Why are insertshandled differently from updates? 2. Can not I use the

Re: [GENERAL] bytea or large objects?

2005-08-26 Thread Peter Wilson
Howard Cole wrote: Hi, I am going to create binary objects in a database which are compressed eml files (1K - 10 Mbytes in size). Am I better using the bytea or large objects? Is there still an issue with backup and restore of databases using large objects with pg_dump/restore? Thanks in

Re: [GENERAL] Postgresql replication

2005-08-26 Thread Chris Browne
[EMAIL PROTECTED] (Chris Travers) writes: William Yu wrote: This system sounds ok for documents and general data that can always be revived via version control/history. But I can't see how this would work for financial transactions where you're dealing with money and bank accounts. Suppose I

[GENERAL] pg_restore problem when restoring big table

2005-08-26 Thread RexHsu
Postgresql 8.0.3 Windows XP with SP2 C:\Program Files\PostgreSQL\8.0\binpg_restore --dbname=smedb --verbose --ignore -version --host=localhost --username=postgres c:\backup2005-08-08 10 .47.06 when it was restoring data of one big table,it returned error msg like [custom archive] can not read

[GENERAL] Postgresql Function Cookbook/General howto

2005-08-26 Thread Tony Caduto
Hi, I have started a function/howto repository on my forums and seeded it with a few functions/howtos http://www.milwaukeesoft.com/forums/viewforum.php?f=12 Feel free to post any handy functions you wouldn't mind sharing with everyone. Thanks, Tony ---(end of

Re: [GENERAL] bytea or large objects?

2005-08-26 Thread Joshua D. Drake
I've just re-written our Whitebeam code to drop large-objects in favour of BYTEA fields. All the old problems of large objects in backups exist, but the killer for us was that none of the current replication systems, at least that I could find, would replicate large objects. This became a

Re: [GENERAL] postgres optimizer

2005-08-26 Thread Joshua D. Drake
Tom Lane wrote: Hossein S. Attar [EMAIL PROTECTED] writes: I am working on postgres optimizer code to add some statistics collection features for an academic project. At some point in my work, I need to be able to tell if a join is a foreign key join or not. Also in case of a foreign key

Re: [GENERAL] Is there going to be a 8.1 beta for win32?

2005-08-26 Thread Matthew T. O'Connor
I know the installer will be a while, but can someone put up a binary-no-installer type zip file on the server somewhere? I know this is done for other releases. Thanks, Matt Tony Caduto wrote: Thanks Magnus, yes by default I meant binary since that is how the majority of win32 software

Re: [GENERAL] TG_OP and undefined OLD values

2005-08-26 Thread Tom Lane
Mike Nolan [EMAIL PROTECTED] writes: The following code fails because the OLD value is not defined: if TG_OP = ''INSERT'' or (TG_OP = ''UPDATE'' and NEW.column1 != coalesce(OLD.column1,''--'')) then column2 := ''CHANGED''; end if; Shouldn't OLD.column1 not even be

[GENERAL] postgresql performance degradation over time....

2005-08-26 Thread sunil arora
Hi folks, this is my first post to this emailing list. We are using postgres-7.4 in a Server based application which requires frequent updates and inserts of the database. We have observed a substantial fall in the performance of database server over the time. It works fine for some initial days

Re: [GENERAL] Serials jumping

2005-08-26 Thread Matt A.
I did not know that about every call to nextval, but that does make sense. I need a way to return the new ID of the SERIAL column on INSERT to add the related rows into the proper tables explictly. Similiar to how I could use @@identity to retrive the value in sql2000. The only ways I saw was

Re: [GENERAL] bytea or large objects?

2005-08-26 Thread Peter Wilson
Joshua D. Drake wrote: I've just re-written our Whitebeam code to drop large-objects in favour of BYTEA fields. All the old problems of large objects in backups exist, but the killer for us was that none of the current replication systems, at least that I could find, would replicate large

Re: [GENERAL] Serials jumping

2005-08-26 Thread Joshua D. Drake
Matt A. wrote: I did not know that about every call to nextval, but that does make sense. I need a way to return the new ID of the SERIAL column on INSERT to add the related rows into the proper tables explictly. Similiar to how I could use @@identity to retrive the value in sql2000. Once

[GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread vishal saberwal
hi, I am not sure if this is a bug. My PG_HBA.CONF local all all trust host all all 127.0.0.1 255.255.255.255 trust host all all 192.168.0.0/16 trust hostssl dbm all 192.168.200.201 255.255.255.255 md5 CODE --- PGConn*

Re: [GENERAL] Postgresql replication

2005-08-26 Thread Chris Travers
William Yu wrote: Chris Travers wrote: Why not have the people who have rights to review this all write to the master database and have that replicated back? It seems like latency is not really an issue. Replication here is only going to complicate What master database? Having a

Re: [GENERAL] postgresql performance degradation over time....

2005-08-26 Thread Bruno Wolff III
On Fri, Aug 26, 2005 at 22:13:04 +0530, sunil arora [EMAIL PROTECTED] wrote: Hi folks, this is my first post to this emailing list. We are using postgres-7.4 in a Server based application which requires frequent updates and inserts of the database. We have observed a substantial fall in

[GENERAL] SPs performance...

2005-08-26 Thread Cristian Prieto
I need to fine tuning my postgresql for performance, I depend a lot in a couple and few SPs to made a sort of kind of tasks, the most of those pgsql sps are made in pl/pgsql, most of them are simple: create or replace function sp_one(id integer) returns setof table1 as $$ declare var

Re: [GENERAL] Postgresql replication

2005-08-26 Thread Matt Miller
On Thu, 2005-08-25 at 17:45 -0700, Jeff Davis wrote: The replicator surely is not optional, and must be centralized. From http://pgcluster.projects.postgresql.org/1_3/index.html: Several replication server can be set up. When an problem occurs at the replication server, Cluster DB automatically

[GENERAL] Altering functions cast

2005-08-26 Thread Matt A.
How do I get this to work? create function nullif_bool(boolean) returns bool as ' select nullif(''$1'',)::bool;' language sql; ??? Thank you. Start your day with Yahoo! - make it your home page

[GENERAL] GROUP BY requirement

2005-08-26 Thread Bill Moseley
I'm wondering if adding a GROUP BY (as required by Postgres) will change the results of a select on a view. I have the following view which joins a class with a teacher. A teacher is a person and I have an instructors link table. CREATE VIEW class_list (id, class_time, instructor ) AS

Re: [GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread Michael Fuhr
On Fri, Aug 26, 2005 at 10:23:10AM -0700, vishal saberwal wrote: OUTPUT: connection failure: SSL error: sslv3 alert handshake failure What appears in the server's log when this happens? I do have (ssl=true) in postgresql.conf and have tested the certificates and they are working right. How

Re: [GENERAL] Altering functions cast

2005-08-26 Thread Michael Fuhr
On Fri, Aug 26, 2005 at 12:22:27PM -0700, Matt A. wrote: How do I get this to work? create function nullif_bool(boolean) returns bool as ' select nullif(''$1'',)::bool;' language sql; If an empty string is a possible input then the argument type can't be boolean because you'll get a

Re: [GENERAL] PG 8.0 CONNECT BY patch

2005-08-26 Thread Tom Lane
Steve Manes [EMAIL PROTECTED] writes: Has anyone applied this patch? Any comments on it? The pg-hier thing? The fact that it hasn't gotten into the distribution should give you a clue what the principal hackers think of it ;-). Still, I hear there are people using it. Beware that it makes an

[GENERAL] About ERROR: must be *superuser* to COPY to or from a file

2005-08-26 Thread Emi Lu
Greetings, I met a question about Copy. I tried to run : copy test(studid) from '/myownDIR/a.txt'; But I got an error as the following: ERROR: must be *superuser* to COPY to or from a file May I know is it possible that instead of supervuser, regular users are able to use COPY as well?

Re: [GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread Tom Lane
Michael Fuhr [EMAIL PROTECTED] writes: Is it possible that your program is linked against an old version of libpq? I can reproduce the above error with an otherwise working 8.0.3 setup if I link the program against a 7.4.8 libpq. The CVS logs show quite a bit of work done on SSL support

[GENERAL] PG 8.0 CONNECT BY patch

2005-08-26 Thread Steve Manes
Has anyone applied this patch? Any comments on it? ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Postgresql Function Cookbook/General howto

2005-08-26 Thread Bruce Momjian
I have source to the old PL/PgSQL cookbook. Do you want it? --- Tony Caduto wrote: Hi, I have started a function/howto repository on my forums and seeded it with a few functions/howtos

Re: [GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread vishal saberwal
sorry, but forgot to mention, when i change to sslmode=allow, it lets me connect and runs my query on 'select * from test_table' which is a dummy table ... [EMAIL PROTECTED] serv]# ./bin/test_lib ret=0 GOT CONNECTION NAME AGE me

Re: [GENERAL] About ERROR: must be *superuser* to COPY to or from a file

2005-08-26 Thread Douglas McNaught
Emi Lu [EMAIL PROTECTED] writes: Greetings, I met a question about Copy. I tried to run : copy test(studid) from '/myownDIR/a.txt'; But I got an error as the following: ERROR: must be *superuser* to COPY to or from a file May I know is it possible that instead of supervuser, regular

Re: [GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread vishal saberwal
hi tom and michael, thanks for your response ... i guess i am not that smart with libraries ... I am not sure as to how i can find the version of libpq that i am using on my server. My test file has sslmode=prefer. This is what i did: (a) [EMAIL PROTECTED] serv]# ./bin/test_lib Connection

Re: [GENERAL] POSS. FEATURE REQ: Dynamic Views

2005-08-26 Thread Greg Stark
Ian Harding [EMAIL PROTECTED] writes: Brand X doesn't do it in their backend either. If your Brand X is the same as my Brand X then it's worth noting that they didn't previously do anything sane in their backend. It used to invalidate all your views and you had to recompile them before they

Re: [GENERAL] Postgresql Function Cookbook/General howto

2005-08-26 Thread Tony Caduto
Hi Bruce, That would be great :-) Thank you very much. I will keep the author information etc intact. Thanks again, Tony Bruce Momjian wrote: I have source to the old PL/PgSQL cookbook. Do you want it? ---

Re: [GENERAL] POSS. FEATURE REQ: Dynamic Views

2005-08-26 Thread Jim C. Nasby
On Fri, Aug 26, 2005 at 04:54:06PM -0400, Greg Stark wrote: Ian Harding [EMAIL PROTECTED] writes: Brand X doesn't do it in their backend either. If your Brand X is the same as my Brand X then it's worth noting that they didn't previously do anything sane in their backend. It used to

[GENERAL] Altering functions cast

2005-08-26 Thread Matt A.
We use NULLIF() for adding [1|0|null] according to the evalution of nullif('x','') into boolean columns. Where x is [1|0|null], which if it's an empty string (x='') then we add NULL cause NULLIF says if '' == '' then return NULL into boolean. An example wrapper function for this with an integer

Re: [GENERAL] About ERROR: must be *superuser* to COPY to or from a file

2005-08-26 Thread Greg Stark
Douglas McNaught [EMAIL PROTECTED] writes: You can use \copy in 'psql' on the client side, but you have to be a superuser to do COPY on the server side, for security reasons. I wonder if there's any way to relax this constraint. If you're connected via a unix domain socket we can know the

Re: [GENERAL] About ERROR: must be *superuser* to COPY to or from a file

2005-08-26 Thread Douglas McNaught
Greg Stark [EMAIL PROTECTED] writes: Douglas McNaught [EMAIL PROTECTED] writes: You can use \copy in 'psql' on the client side, but you have to be a superuser to do COPY on the server side, for security reasons. I wonder if there's any way to relax this constraint. If you're connected

Re: [GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread Michael Fuhr
On Fri, Aug 26, 2005 at 01:57:36PM -0700, vishal saberwal wrote: I am not sure as to how i can find the version of libpq that i am using on my server. My test file has sslmode=prefer. This is what i did: (a) [EMAIL PROTECTED] serv]# ./bin/test_lib Connection failed: SSL error: sslv3 alert

Re: [GENERAL] PQConnectdb SSL (sslmode): Is this a bug

2005-08-26 Thread Michael Fuhr
On Fri, Aug 26, 2005 at 02:03:05PM -0700, vishal saberwal wrote: sorry, but forgot to mention, when i change to sslmode=allow, it lets me connect and runs my query That's because allow attempts a non-SSL connection first, whereas prefer attempts an SSL connection first. If the server permits

Re: [GENERAL] About ERROR: must be *superuser* to COPY to or from a file

2005-08-26 Thread Michael Fuhr
On Fri, Aug 26, 2005 at 06:04:52PM -0400, Greg Stark wrote: Douglas McNaught [EMAIL PROTECTED] writes: You can use \copy in 'psql' on the client side, but you have to be a superuser to do COPY on the server side, for security reasons. I wonder if there's any way to relax this constraint.

Re: [GENERAL] Altering functions cast

2005-08-26 Thread Matt A.
Hey. I used your suggestion and it worked like a charm! The... CREATE FUNCTION nullif_bool(text) RETURNS boolean AS ' BEGIN RETURN nullif($1, ); END; ' LANGUAGE plpgsql IMMUTABLE STRICT; THANK YOU! --- Michael Fuhr [EMAIL PROTECTED] wrote: On Fri, Aug 26, 2005 at 12:22:27PM

Re: [GENERAL] Postgresql replication

2005-08-26 Thread William Yu
Chris Travers wrote: I guess I am thinking along different lines than you. I was thinking that the simplest solution would be to have master/slave replication for *approved* transactions only and no replication for initial commits prior to approval. This makes the assumption that a single

Re: [GENERAL] Postgresql replication

2005-08-26 Thread Chris Travers
William Yu wrote: Chris Travers wrote: I guess I am thinking along different lines than you. I was thinking that the simplest solution would be to have master/slave replication for *approved* transactions only and no replication for initial commits prior to approval. This makes the

Re: [GENERAL] POSS. FEATURE REQ: Dynamic Views

2005-08-26 Thread Bruce Momjian
Jim C. Nasby wrote: I wonder whether it would be saleable to have an option to work around this feature. I'm thinking one of two directions: 1) An alternate type of view that just stores the text of the view and is interpreted at time of use like: CREATE DYNAMIC VIEW foo AS (SELECT

Re: [GENERAL] About ERROR: must be *superuser* to COPY to or from a file

2005-08-26 Thread Greg Stark
Douglas McNaught [EMAIL PROTECTED] writes: Greg Stark [EMAIL PROTECTED] writes: If you're connected via a unix domain socket we can know the UID of the client end. I don't see reproducing the entire unix semantics but if file is owned by the same uid as the user connecting it seems