Re: [GENERAL] libpq.dll - how to check if field is nullable

2005-08-23 Thread Sivakumar K
I believe by now you would have found it out by going through the PostgreSQL documentation. If not you can use PQgetisnull (result, row_no, col_no) Regards, Siva Kumar.K -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pit M. Sent: Monday, August 15,

[GENERAL] How to limit database size

2005-08-23 Thread Vishnu
Hi, How can I limit the maximum space uses by Posgres database ??. So that it should not use total disk space available on system. Thanks in advance, Vishnu ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an

[GENERAL] postgresql hosting

2005-08-23 Thread Reid Thompson
Someone questioned a while back about hosting providers for PostgreSQL -- a recent post led to finding http://www.planetargon.com/hosting/ ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] How to limit database size

2005-08-23 Thread A. Kretschmer
am 23.08.2005, um 15:12:54 +0530 mailte Vishnu folgendes: Hi, How can I limit the maximum space uses by Posgres database ??. So that it should not use total disk space available on system. You can use the tools from the os, under Linux for instance quotas. You can also put the data dir on

Re: [GENERAL] Consulta

2005-08-23 Thread Leonel Nunez
Macario Mares wrote: He tratado de importar datos con la instrucción COPY pero no he podido. Les agradeceria me dieran un ejemplo de cómo importar datos ya sea de Windows o linux si das mas info de porque no puedes seria mejor con lo que comentas lo unico que te puedo comentar es que

[GENERAL] ctid access is slow

2005-08-23 Thread Ilja Golshtein
Hello! Could anybody help me with this [artificial] query select ctid from aaa where ctid in (select ctid from aaa limit 10); here is explained plan Nested Loop IN Join (cost=3.47..300325932.99 rows=10 width=6) Join Filter: (outer.ctid = inner.ctid) - Seq Scan on aaa

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Robert Treat
On Tuesday 23 August 2005 08:39, Ilja Golshtein wrote: Hello! Could anybody help me with this [artificial] query select ctid from aaa where ctid in (select ctid from aaa limit 10); here is explained plan Nested Loop IN Join (cost=3.47..300325932.99 rows=10 width=6) Join

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Michael Fuhr
On Tue, Aug 23, 2005 at 09:15:42AM -0400, Robert Treat wrote: On Tuesday 23 August 2005 08:39, Ilja Golshtein wrote: select ctid from aaa where ctid in (select ctid from aaa limit 10); Nested Loop IN Join (cost=3.47..300325932.99 rows=10 width=6) Join Filter: (outer.ctid =

[GENERAL] Consulta

2005-08-23 Thread Macario Mares
He tratado de importar datos  con la instrucción COPY pero no he podido. Les agradeceria me dieran un ejemplo de cómo importar datos ya sea de Windows o linux

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Ilja Golshtein
Hello! On Tue, Aug 23, 2005 at 09:15:42AM -0400, Robert Treat wrote: On Tuesday 23 August 2005 08:39, Ilja Golshtein wrote: select ctid from aaa where ctid in (select ctid from aaa limit 10); Aside from that, ctid is of type tid, and its equality operator isn't hashable. It is the piece

Re: [GENERAL] ORDER BY time consuming

2005-08-23 Thread Thomas F. O'Connell
You're also free to set sort_mem (7.4.x) or work_mem (8.0.x) on a per session basis, so you could try experimenting with raising the value of those settings during sessions in which your query is running. -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC Strategic Open

[GENERAL] Question about Foreign key constraint causes costly sequential scans?

2005-08-23 Thread Emi Lu
Greetings, I have a question about foreign key cost. I have two tables A and B. A has 300,000 records, B has 3 records. A (col1, col2, col3... ... colN) B (colB1 primary key, colB2) I'd like to setup foreign key constraint for A.col3, as the following: CONSTRAINT Aclo3_fk FOREIGN KEY (col3)

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Tom Lane
Michael Fuhr [EMAIL PROTECTED] writes: On Tuesday 23 August 2005 08:39, Ilja Golshtein wrote: select ctid from aaa where ctid in (select ctid from aaa limit 10); Aside from that, ctid is of type tid, and its equality operator isn't hashable. Nor mergejoinable, so there's not much scope for a

Re: [GENERAL] How to limit database size

2005-08-23 Thread Michael Fuhr
On Tue, Aug 23, 2005 at 01:19:11PM +0200, A. Kretschmer wrote: am 23.08.2005, um 15:12:54 +0530 mailte Vishnu folgendes: How can I limit the maximum space uses by Posgres database ??. So that it should not use total disk space available on system. You can use the tools from the os, under

[GENERAL] Import File

2005-08-23 Thread Rodrigo Africani
Hi, I'm trying to import a sequence txt file. The file has fix columns ...i.ethe first 10 positions is the primary key ... Thecomand copy need a delimitier but the file is seq without a delimitier. I look in the manual but i don't won't if it is possible. My problem is the file is very

Re: [GENERAL] Question about Foreign key constraint causes costly sequential scans?

2005-08-23 Thread Tom Lane
Emi Lu [EMAIL PROTECTED] writes: But I got a warning msg from postgresql as: foreign key constraint Aclo3_fk will require costly sequential scans Try to make the referencing and referenced columns the same datatype. regards, tom lane ---(end

Re: [GENERAL] Question about Foreign key constraint causes costly

2005-08-23 Thread Matt Miller
On Tue, 2005-08-23 at 10:30 -0400, Emi Lu wrote: I'd like to setup foreign key constraint for A.col3, as the following: CONSTRAINT Aclo3_fk FOREIGN KEY (col3) REFERENCES B(colB1) But I got a warning msg from postgresql as: foreign key constraint Aclo3_fk will require costly sequential

Re: [GENERAL] Question about Foreign key constraint causes costly sequential scans?

2005-08-23 Thread Michael Fuhr
On Tue, Aug 23, 2005 at 10:30:14AM -0400, Emi Lu wrote: I'd like to setup foreign key constraint for A.col3, as the following: CONSTRAINT Aclo3_fk FOREIGN KEY (col3) REFERENCES B(colB1) But I got a warning msg from postgresql as: foreign key constraint Aclo3_fk will require costly

Re: [GENERAL] Import File

2005-08-23 Thread Michael Fuhr
On Tue, Aug 23, 2005 at 11:47:57AM -0300, Rodrigo Africani wrote: I'm trying to import a sequence txt file. The file has fix columns ... i.e the first 10 positions is the primary key ... The comand copy need a delimitier but the file is seq without a delimitier. I look in the manual but i

[GENERAL] Where to get 8.1 beta test version?

2005-08-23 Thread Kevin Grittner
We want to test the 8.1 beta test version of PostgreSQL on a SUSE Linux box. What would be the best download for this? TIA, -Kevin ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate

Re: [GENERAL] Question about Foreign key constraint causes costly

2005-08-23 Thread Emi Lu
Thanks a lot for all helps. I do not have warnings anymore :-) I'd like to setup foreign key constraint for A.col3, as the following: CONSTRAINT Aclo3_fk FOREIGN KEY (col3) REFERENCES B(colB1) But I got a warning msg from postgresql as: foreign key constraint Aclo3_fk will require costly

Re: [GENERAL] Where to get 8.1 beta test version?

2005-08-23 Thread Kevin Grittner
My mistake. - Any idea when it will get to beta test status? - Is it currently stable enough to make a real-world test worthwhile? - Would this be the snapshot you mentioned?: http://wwwmaster.postgresql.org/download/mirrors-ftp?file=dev%2Fpostgresql-snapshot.tar.gz Thanks,

Re: [GENERAL] Where to get 8.1 beta test version?

2005-08-23 Thread Bruce Momjian
Kevin Grittner wrote: We want to test the 8.1 beta test version of PostgreSQL on a SUSE Linux box. What would be the best download for this? We are not in beta yet, but you can grab the nightly snapshot from the ftp server. -- Bruce Momjian|

Re: [GENERAL] Where to get 8.1 beta test version?

2005-08-23 Thread Bruce Momjian
Kevin Grittner wrote: My mistake. - Any idea when it will get to beta test status? - Is it currently stable enough to make a real-world test worthwhile? - Would this be the snapshot you mentioned?:

Re: [GENERAL] Question about Foreign key constraint causes costly

2005-08-23 Thread Michael Fuhr
On Tue, Aug 23, 2005 at 02:53:33PM +, Matt Miller wrote: On Tue, 2005-08-23 at 10:30 -0400, Emi Lu wrote: I'd like to setup foreign key constraint for A.col3, as the following: CONSTRAINT Aclo3_fk FOREIGN KEY (col3) REFERENCES B(colB1) But I got a warning msg from postgresql as:

Re: [GENERAL] Import File

2005-08-23 Thread A. Kretschmer
am 23.08.2005, um 11:47:57 -0300 mailte Rodrigo Africani folgendes: Hi, I'm trying to import a sequence txt file. The file has fix columns ... i.e the first 10 positions is the primary key ... The comand copy need a delimitier but the file is seq without a delimitier. I look in the manual

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Ilja Golshtein
Hi! Could anybody help me with this [artificial] query select ctid from aaa where ctid in (select ctid from aaa limit 10); [skipped] I think using an indexed field would probably be faster for you, especially if you have a PK on the table. I used to think ctid is the same as rowid in

Re: [GENERAL] Where to get 8.1 beta test version?

2005-08-23 Thread Bruno Wolff III
On Tue, Aug 23, 2005 at 10:36:34 -0500, Kevin Grittner [EMAIL PROTECTED] wrote: - Any idea when it will get to beta test status? Based on the discussions I have seen, the first beta will probably be released within a week. - Is it currently stable enough to make a real-world test

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Alvaro Herrera
On Tue, Aug 23, 2005 at 05:30:31PM +0400, Ilja Golshtein wrote: Hi! Could anybody help me with this [artificial] query select ctid from aaa where ctid in (select ctid from aaa limit 10); [skipped] I think using an indexed field would probably be faster for you, especially if you

Re: [GENERAL] OCFS released as GPL

2005-08-23 Thread Alvaro Herrera
On Mon, Aug 22, 2005 at 08:55:00AM -0300, Bruno Almeida do Lago wrote: I haven't found any message on archives talking about this, so I'm posting it. The OCFS (Oracle Cluster File System) is now GPL - see more on http://oss.oracle.com/projects/ocfs/ What do you think? The file system is

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: If you are too worried about it, you could look at what is needed to implement hashjoin and mergejoin for ctids. I take it it isn't trivial, or it would be done already, but I don't think it's too hard (unless there is an implementation detail that

[GENERAL] plpgsql: returning multiple named columns from function *simply*

2005-08-23 Thread John Lawler
Hi guys, First time (I think, certainly recently) posting to this mailing list. I've been casually using Postgres for a couple of years, but recently am going to be using it in a professional settings, so I figure it's time to get serious about learning the right way to write functions/stored

Re: [GENERAL] plpgsql: returning multiple named columns from function

2005-08-23 Thread Joshua D. Drake
CREATE PROCEDURE test( @lookup char(50)) WITH ENCRYPTION AS BEGIN -- ... a bunch of code to do some lookup, and then ... SELECT @Result1 AS Result1, @Result2 AS Result2, @Result3 AS Result3, @Result4 AS Result4 END GO and then when I call this procedure, I get a result row (like it

Re: [GENERAL] plpgsql: returning multiple named columns from function

2005-08-23 Thread John Lawler
Joshua D. Drake wrote: perhaps even any existing column in a table. I think what you are looking for is SetOF functions. http://www.postgresql.org/docs/8.0/interactive/functions-srf.html Thanks for the response. The reference you indicated is talking about Set Returning Functions. I'm

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Alvaro Herrera
On Tue, Aug 23, 2005 at 06:02:05PM +0400, Ilja Golshtein wrote: The only thing I am curios is ctid good for anything from user point of view? No -- it changes far too frequently for that. -- Alvaro Herrera (alvherre[a]alvh.no-ip.org) Un poeta es un mundo encerrado en un hombre (Victor Hugo)

Re: [GENERAL] plpgsql: returning multiple named columns from function

2005-08-23 Thread Tony Caduto
you can do this with a function that returns a refcursor. (lookup refcursor in the docs) you would call it something like this select mycursorfunct(); fetch all from return_cursor; In this example I hardcode the name return cursor and then call both lines from a transaction. you could also

Re: [GENERAL] plpgsql: returning multiple named columns from function *simply*

2005-08-23 Thread Roger Hand
John Lawler wrote: In MSSQL, I can write a stored procedure that does something like this: CREATE PROCEDURE test( @lookup char(50)) WITH ENCRYPTION AS BEGIN -- ... a bunch of code to do some lookup, and then ... SELECT @Result1 AS Result1, @Result2 AS Result2, @Result3

[GENERAL] drop table before create

2005-08-23 Thread Mark Probert
Hi .. I have not been able to work out how to do this is Postgres 8 (pseudo-code) if exists table foo drop table foo; end create table foo; If I go with drop table foo; create table foo; then it barfs on an empty db. I can find the table name in pg_class but I am not sure of where

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Ron Mayer
Tom Lane wrote: It wouldn't be hard that I can see (just build hash and btree opclasses for tid), but I'm pretty unclear on why bother. There's no use-case for cross-table joins involving ctid, since you couldn't usefully store a ctid referencing another table. The example Ilja showed was

[GENERAL] Optimize a VIEW question

2005-08-23 Thread Bill Moseley
I'm just starting out using VIEWs -- and mostly new to postgresql and I'm trying to learn a little about reading the EXPLAIN ANALYZE output. I have the following view setup and I'm wonder where to create indexes, and mostly if I'm doing anything the incorrect or a very expensive way. CREATE

[GENERAL] [newbie] server startup

2005-08-23 Thread Mark Probert
Hi .. I am just playing with PostgreSQL 8.0.1 The server is running on a Solaris 8 platform with the kernel parameters tweaked as suggested. When I start the server, the logfile reports: $ pg_ctl start -l logfile postmaster starting $ cat logfile LOG: could not bind

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Robert Treat
On Tuesday 23 August 2005 15:55, Alvaro Herrera wrote: On Tue, Aug 23, 2005 at 06:02:05PM +0400, Ilja Golshtein wrote: The only thing I am curios is ctid good for anything from user point of view? No -- it changes far too frequently for that. Oh I dunno... In general I'd agree with you,

Re: [GENERAL] [newbie] server startup

2005-08-23 Thread Mark Probert
Hi .. On Tue, 2005-08-23 at 14:45 -0700, Mark Probert wrote: SO, the db is up and running locally but I can't get to it from the network. With a friend's help, I worked out that I need to edit two files: postgresql.conf (listen_address = '*') pg_hba.conf (add host all all

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Jeff Eckermann
Ilja Golshtein [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello! On Tue, Aug 23, 2005 at 09:15:42AM -0400, Robert Treat wrote: On Tuesday 23 August 2005 08:39, Ilja Golshtein wrote: select ctid from aaa where ctid in (select ctid from aaa limit 10); Aside from that, ctid is

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Jim C. Nasby
On Wed, Aug 24, 2005 at 09:26:10AM +0930, Jeff Eckermann wrote: The ctid value can be useful in a multi user application, to check whether a record has been changed by another user, before committing changes. Whenever a record is updated the ctid value will be changed, so by storing the

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Jeff Eckermann
--- Jim C. Nasby [EMAIL PROTECTED] wrote: On Wed, Aug 24, 2005 at 09:26:10AM +0930, Jeff Eckermann wrote: The ctid value can be useful in a multi user application, to check whether a record has been changed by another user, before committing changes. Whenever a record is updated the

[GENERAL] ERROR: database is being accessed by other users

2005-08-23 Thread wolverine my
Hi! I got the following psql's error when executing a script, ERROR: database test is being accessed by other users To solve this, I have to disconnect the database connection from the pgAdmin III. May I know how can I configure the database to allow multiple user access?

Re: [GENERAL] ERROR: database is being accessed by other users

2005-08-23 Thread Michael Fuhr
On Wed, Aug 24, 2005 at 10:10:55AM +0800, wolverine my wrote: I got the following psql's error when executing a script, ERROR: database test is being accessed by other users What does the script do? Based on the error message I'd guess that you're trying to drop or rename the database. To

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Tom Lane
Jim C. Nasby [EMAIL PROTECTED] writes: I believe that's not necessarily true. If you select a tuple and it's ctid and it's updated more than once with a vacuum in-between I believe it could end up back in the same position, which would mean the same ctid. This is the reason for the

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Jeff Eckermann
--- Tom Lane [EMAIL PROTECTED] wrote: Jim C. Nasby [EMAIL PROTECTED] writes: I believe that's not necessarily true. If you select a tuple and it's ctid and it's updated more than once with a vacuum in-between I believe it could end up back in the same position, which would mean the same

Re: [GENERAL] plpgsql: returning multiple named columns from function

2005-08-23 Thread Tom Lane
John Lawler [EMAIL PROTECTED] writes: Plus, the main part was to be able to have the columns (arbitrarily) named as if they'd been selected from a table. I hope that there's something about as easy as the example I cited from MS SQL. In existing releases you need to create a named composite

Re: [GENERAL] ctid access is slow

2005-08-23 Thread Jim C. Nasby
On Tue, Aug 23, 2005 at 06:42:33PM -0700, Jeff Eckermann wrote: I believe that's not necessarily true. If you select a tuple and it's ctid and it's updated more than once with a vacuum in-between I believe it could end up back in the same position, which would mean the same ctid.

Re: [GENERAL] ERROR: database is being accessed by other users

2005-08-23 Thread wolverine my
Hi, Michael You are right, the script was trying to drop the database and the error makes sense to me now. Thank you! On 8/24/05, Michael Fuhr [EMAIL PROTECTED] wrote: On Wed, Aug 24, 2005 at 10:10:55AM +0800, wolverine my wrote: I got the following psql's error when executing a script,