Re: [GENERAL] database constraints

2004-10-06 Thread David Garamond
David Fetter wrote: BTW, "id" is a terrible name for a column. Better call it foo_id. I disagree with the idea that "id" is a terrible name for a column. The only negative to it, is that you will have to be explicit in your declarations when doing joins and such... ex: SELECT * FROM foo JOIN

[GENERAL] Current wisdom wrt fsm on 8.0

2004-10-06 Thread elein
What is the current wisdom on setting the fsm variables for 8.0? How is it different from 7.4? Or is it? I am assuming these are the values that changed with Jan's changes. If not what were those variables? (I can't seem to track down the threads on these things.) --elein

[GENERAL] pgpool log errors

2004-10-06 Thread postgresql . org
I've started using pgpool and while everything appears to be working, I've been getting a lot of the following errors in my logs: ERROR: pid 14761: pool_read: EOF encountered This seems to be simple enough - the client/user probably just canceled the request and isn't anything to be conc

Re: [GENERAL] postgres.h location?

2004-10-06 Thread Scott Frankel
Default now installs all headers ... with v8.0 of postgres, right? New to postgres (and db's for that matter) I just downloaded the tarball for postgres-7.4.5. Invoking the make install-all-headers cmd did indeed produce the servers subdir under include. Unfortunately, my attempts to build PyGreSQ

Re: [GENERAL] Help on copy function

2004-10-06 Thread Doug McNaught
Tom Lane <[EMAIL PROTECTED]> writes: > Doug McNaught <[EMAIL PROTECTED]> writes: >> It's also possible that PG is trying to create a new table file and >> he's out of inodes... > > Good thought, although I think that this particular error message would > only come out from a seek/write failure an

Re: [GENERAL] Help on copy function

2004-10-06 Thread Tom Lane
Doug McNaught <[EMAIL PROTECTED]> writes: >>> psql:lineitem.loader.psql:1: ERROR: could not extend relation >>> 24342131/24342133 >>> /24342324: There is not enough space in the file system. >>> HINT: Check free disk space. >> >> Maybe you are running the postmaster under a disk-space-usage limi

Re: [GENERAL] postgres.h location?

2004-10-06 Thread Bruce Momjian
The option install-all-headers was removed in the past few days because install by default now installs all headers. --- Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > On Wed, Oct 06, 2004 at 03:27:39PM -0400

Re: [GENERAL] Help on copy function

2004-10-06 Thread Doug McNaught
Tom Lane <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: >> And an error occurs : >> psql:lineitem.loader.psql:1: ERROR: could not extend relation >> 24342131/24342133 >> /24342324: There is not enough space in the file system. >> HINT: Check free disk space. > >> but my fileSystem has s

Re: [GENERAL] postgres.h location?

2004-10-06 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Wed, Oct 06, 2004 at 03:27:39PM -0400, Tom Lane wrote: >> You need to do "make install-all-headers" while installing to install >> the server-side headers there. > BTW, did this just change in 8.0? There was a proposal to change it, but I dunno if it

Re: [GENERAL] postgres.h location?

2004-10-06 Thread Michael Fuhr
On Wed, Oct 06, 2004 at 03:27:39PM -0400, Tom Lane wrote: > Scott Frankel <[EMAIL PROTECTED]> writes: > > My build of postgres-7.4.5 did produce an include dir, > > /usr/local/pgsql/include; > > but it does not contain postgres.h. > > You need to do "make install-all-headers" while installing to

Re: [GENERAL] Mirroring databases in v8

2004-10-06 Thread Glen Eustace
On Thu, 2004-10-07 at 03:06, Tom Lane wrote: > Not sure if you are familiar with the Slony project, but that is > probably your best bet for data propagation to a live slave at present Hi Tom, Thanks for the comment. I was aware of Slony but didn't want the mirroring to require addition of trigg

Re: [GENERAL] Help on copy function

2004-10-06 Thread Tom Lane
[EMAIL PROTECTED] writes: > And an error occurs : > psql:lineitem.loader.psql:1: ERROR: could not extend relation > 24342131/24342133 > /24342324: There is not enough space in the file system. > HINT: Check free disk space. > but my fileSystem has something like 2Go free when copy fails! Maybe

Re: [GENERAL] passing new.* in trigger

2004-10-06 Thread Tom Lane
Alessandro Vincelli <[EMAIL PROTECTED]> writes: > I must pass NEW row to function count_room(rowtype) as in this code, but > pgsql return "_ NEW used in query that is not in a rule". > I have a bad syntax or is impossible pass NEW.*? That will work in 8.0, but not before.

Re: [GENERAL] postgres.h location?

2004-10-06 Thread Tom Lane
Scott Frankel <[EMAIL PROTECTED]> writes: > My build of postgres-7.4.5 did produce an include dir, > /usr/local/pgsql/include; > but it does not contain postgres.h. You need to do "make install-all-headers" while installing to install the server-side headers there. regard

[GENERAL] Activestate Perl and DBD-Pg?

2004-10-06 Thread David Siebert
Anyone using Activestate Perl and DBD-Pg? I am using perl 5.8.3 ppm does not seem to work. I downloaded the DBD-Pg .zip file I found through google but ppm could not seem to install that. Any suggestions? ---(end of broadcast)--- TIP 2: you can get

Re: [GENERAL] database constraints

2004-10-06 Thread Joshua D. Drake
This brings up an interesting idea. What if it were possible to set some kind of rules on DDL at database creation time? For example, I'd like to be able to throw an error if somebody tries to name an object any of the SQL keywords. Other possible rules: * Every table must have a comment * noCam

Re: [GENERAL] dangling permission on tables after drop user.

2004-10-06 Thread Andrew Sullivan
On Thu, Sep 30, 2004 at 10:03:29AM -0400, Alvaro Herrera wrote: > > I'm afraid you'll have to ALTER TABLE (or whatever) for each of these ... > I don't think there is a command that would help you do that > automatically. You can cheat by looking at system catalogs for the > acl column (e.g. pg_

Re: [GENERAL] database constraints

2004-10-06 Thread Bruno Wolff III
On Wed, Oct 06, 2004 at 08:35:21 -0700, [EMAIL PROTECTED] wrote: > * Ben <[EMAIL PROTECTED]> [2004-10-06 08:23:11 -0700]: > > ALTER TABLE foo ADD CONSTRAINT must_have_a_or_b CHECK (a::int IS NULL > AND b::int IS NOT NULL OR a::int IS NOT NULL AND b::int IS NULL); A simpler constraint is: check

Re: [GENERAL] database constraints

2004-10-06 Thread David Fetter
On Wed, Oct 06, 2004 at 10:07:43AM -0700, Joshua D. Drake wrote: > >> > >>SELECT * FROM foo > >> JOIN bar on (foo.id = bar.id) > >> > >>Personally I would rather see, and write that then: > >> > >>SELECT * FROM foo > >> JOIN bar on (foo_id = bar_id) > > > > > >With all due respect, Josh, naming y

[GENERAL] postgres.h location?

2004-10-06 Thread Scott Frankel
I'm looking for the file postgres.h in my recent install of postgres-7.4.5 on a MacOS 10.3.5 system. I'm attempting to build PyGreSQL-3.5, which appears to require the postgres include dir. My build of postgres-7.4.5 did produce an include dir, /usr/local/pgsql/include; but it does not contain

Re: [GENERAL] database constraints

2004-10-06 Thread Joshua D. Drake
SELECT * FROM foo JOIN bar on (foo.id = bar.id) Personally I would rather see, and write that then: SELECT * FROM foo JOIN bar on (foo_id = bar_id) With all due respect, Josh, naming your columns with decipherable names, i.e. *not* having 50 different things called "id" in your db helps enormo

Re: [GENERAL] Random not so random

2004-10-06 Thread Marco Colombo
On Tue, 5 Oct 2004, Tom Lane wrote: now.tv_sec, and it's perfectly portable. No one in their right mind expects random(3) to be cryptographically secure anyway, so doing more doesn't seem warranted. Tom, having a source of "real" random data isn't useful just for crypto applications. No PRNG is pe

Re: [GENERAL] Random not so random

2004-10-06 Thread Bruno Wolff III
I am going to keep this on general for now, since it seems like other people might be interested even though it is straying a somewhat off topic. On Wed, Oct 06, 2004 at 18:02:39 +0200, Marco Colombo <[EMAIL PROTECTED]> wrote: > > It depends. What's wrong with a SQL function taking long to > co

Re: [GENERAL] database constraints

2004-10-06 Thread David Fetter
On Wed, Oct 06, 2004 at 09:32:02AM -0700, Joshua D. Drake wrote: > >What's "reasonable?" ;) > > > >BTW, "id" is a terrible name for a column. Better call it foo_id. > > Hello, > > I disagree with the idea that "id" is a terrible name for a column. The > only negative to it, is that you will h

Re: [GENERAL] database constraints

2004-10-06 Thread Joshua D. Drake
What's "reasonable?" ;) BTW, "id" is a terrible name for a column. Better call it foo_id. Hello, I disagree with the idea that "id" is a terrible name for a column. The only negative to it, is that you will have to be explicit in your declarations when doing joins and such... ex: SELECT * FRO

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-06 Thread Mark Gibson
Tom Lane wrote: Mark Gibson <[EMAIL PROTECTED]> writes: Right then, I think I've got this sorted, DROP TABLE worked after a swift: DELETE FROM pg_depend WHERE objid = 5173132; There's something awfully flaky going on here. The system should never have let you get into this state in the first plac

[GENERAL] Help on copy function

2004-10-06 Thread frederic . germaneau
I'm trying to stress PostgreSQL 8beta3 on AIX5.2 with TPCH 1 Go I have created and configurated a database on 2 tablespaces : first one for indexes and second one for tables First script for database creation: $ more scrCreateDataBase.sh psql template1<

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-06 Thread Tom Lane
Mark Gibson <[EMAIL PROTECTED]> writes: > Right then, I think I've got this sorted, > DROP TABLE worked after a swift: > DELETE FROM pg_depend WHERE objid = 5173132; There's something awfully flaky going on here. The system should never have let you get into this state in the first place: the ent

Re: [GENERAL] database constraints

2004-10-06 Thread Dennis Gearon
Use a post trigger function, ON UPDATE, INSERT which essentially has this in it: if ( ISNULL(new.a) AND ISNULL(new.b) ){ RAISE NOTICE "blah blah"; } I work with PHP a lot, just a little plpgsql, so, the grammar may be wrong above. Ben <[EMAIL PROTECTED]> wrote: If I have have the table: create

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-06 Thread Mark Gibson
Mark Gibson wrote: I'm guessing I'm gonna have to route through pg_catalog for this and delete all deps manually, but it this going to be safe? Would I be better off dumping and restoring the whole database? Right then, I think I've got this sorted, DROP TABLE worked after a swift: DELETE FROM pg_d

[GENERAL] passing new.* in trigger

2004-10-06 Thread Alessandro Vincelli
I must pass NEW row to function count_room(rowtype) as in this code, but pgsql return "_ NEW used in query that is not in a rule". I have a bad syntax or is impossible pass NEW.*? thanks, Ale _ CREATE OR REPLACE FUNCTION public.dr_aggiorna_consistenze() RETURNS trigger AS ' declare room int;

Re: [GENERAL] database constraints

2004-10-06 Thread David Fetter
On Wed, Oct 06, 2004 at 08:23:11AM -0700, Ben wrote: > If I have have the table: > > create table foo > ( > a int references bar(id), > b int references baz(id) > ) > > ... how do I make sure one and only one of the columns a and b are > non-null? You could write it like this: CREA

Re: [GENERAL] database constraints

2004-10-06 Thread sklassen
* Ben <[EMAIL PROTECTED]> [2004-10-06 08:23:11 -0700]: > If I have have the table: > > create table foo > ( > a int references bar(id), > b int references baz(id) > ) > > ... how do I make sure one and only one of the columns a and b are > non-null? Is it even reasonable? ALTER TAB

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP

2004-10-06 Thread Mark Gibson
Tom Lane wrote: Mark Gibson <[EMAIL PROTECTED]> writes: I kept getting the following error: ERROR: cache lookup failed for relation 4667548 This implies that something someplace still has a link to the table with that OID. You could do "\set VERBOSITY verbose" so that the code location the error

Re: [GENERAL] Random not so random

2004-10-06 Thread Michael Fuhr
On Tue, Oct 05, 2004 at 07:23:32AM -0600, Michael Fuhr wrote: > On Tue, Oct 05, 2004 at 02:39:13PM +0200, Harald Fuchs wrote: > > > I think we don't need the randomness provided by /dev/[u]random. How > > about XORing in getpid? > > What about making the seeding mechanism and perhaps random()'s

[GENERAL] database constraints

2004-10-06 Thread Ben
If I have have the table: create table foo ( a int references bar(id), b int references baz(id) ) ... how do I make sure one and only one of the columns a and b are non-null? Is it even reasonable? ---(end of broadcast)--- TIP 4: Don

Re: [GENERAL] Cache lookup failed for relation, when trying to DROP TABLE.

2004-10-06 Thread Tom Lane
Mark Gibson <[EMAIL PROTECTED]> writes: > I kept getting the following error: > ERROR: cache lookup failed for relation 4667548 This implies that something someplace still has a link to the table with that OID. You could do "\set VERBOSITY verbose" so that the code location the error occurs at g

Re: [GENERAL] Commands to browse current connections and processes

2004-10-06 Thread Mark Gibson
Ying Lu wrote: Hello, In mysql, we use "show processlist" to see all current process. Could someone let me know in PostgreSQL, what commands that we can check the current connections and processes please? SELECT * FROM pg_catalog.pg_stat_activity; -- Mark Gibson Web Developer & Database Admin Cr

Re: [GENERAL] two digit years in inserts

2004-10-06 Thread Mike Nolan
> its not my data i am stuck moving this data from a sad access database > designed by a moron. anyway it means i will have to do alot of work on > the script to make it fix that, or just install an old version of pgsql > on a box here and pg_dump the table which seems easier. I've ported a lot

[GENERAL] Commands to browse current connections and processes

2004-10-06 Thread Ying Lu
Hello, In mysql, we use "show processlist" to see all current process. Could someone let me know in PostgreSQL, what commands that we can check the current connections and processes please? Thanks a lot, Ly ---(end of broadcast)--- TIP 1: subscrib

Re: [GENERAL] Mailing

2004-10-06 Thread Bruno Wolff III
On Tue, Oct 05, 2004 at 10:00:29 -0500, Kevin Barnard <[EMAIL PROTECTED]> wrote: > SELECT trim(leading '0' from to_char(now(), 'HH:MM AM')) > > I think is what you really want. This gets rid of the nasty leasing 0. Won't that be a problem for times between and 0059?

[GENERAL] Cache lookup failed for relation, when trying to DROP TABLE.

2004-10-06 Thread Mark Gibson
Hello, I've just encountered a problem that I don't know how to deal with. After having a play with SlonyI, I dropped the entire slony cluster schema, and then tried to drop a schema which held some slave tables for the slony cluster. I kept getting the following error: ERROR: cache lookup faile

Re: [GENERAL] Verifying Referential Integrity

2004-10-06 Thread Jimmie H. Apsey
Tom Lane wrote: "Geisler, Jim" <[EMAIL PROTECTED]> writes: So, as far as I know, PostgreSQL does not have any way of verifying the loss of referential integrity. What are you trying to accomplish here, and in what PG version? Are you trying to check that PG thinks that

Re: [GENERAL] Random not so random

2004-10-06 Thread Bruno Wolff III
On Tue, Oct 05, 2004 at 11:27:05 +0200, Marco Colombo <[EMAIL PROTECTED]> wrote: > On Mon, 4 Oct 2004, Bruno Wolff III wrote: > > >You don't want to use /dev/random. You aren't going to get better random > >numbers that way and blocking reads is a big problem. > > Sure you are. As far as the en

Re: [GENERAL] two digit years in inserts

2004-10-06 Thread Justin Wyer
Tom Lane wrote: Justin Wyer <[EMAIL PROTECTED]> writes: I have this problem, I wrote a script to insert data into a table, one of the columns is a birthdate now I only have the last two year digits, and this all worked fine. Until I did a portupgrade (i am running on bsd 5.2.1 and 4.8 and pos

Re: [GENERAL] two digit years in inserts

2004-10-06 Thread Tom Lane
Justin Wyer <[EMAIL PROTECTED]> writes: > I have this problem, I wrote a script to insert data into a table, one > of the columns is a birthdate now I only have the last two year digits, > and this all worked fine. Until I did a portupgrade (i am running on bsd > 5.2.1 and 4.8 and postgresql 7.3

Re: OT: spherical geometry (Re: [GENERAL] earthdistance is not giving ...)

2004-10-06 Thread Bruno Wolff III
On Wed, Oct 06, 2004 at 08:52:55 +0200, Holger Klawitter <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Sunday 03 October 2004 20:22, Bruno Wolff III wrote: > > Latitudes greater than 90 degrees have a reasonable > > meaning and it can be useful to use 0 to 1

Re: [GENERAL] lower/upper support and cyrillic

2004-10-06 Thread pginfo
Hi Oleg and Alvaro, It is great news for me. I will test it next week in beta 3 and will waiting for the release. regards, iavn. Alvaro Herrera wrote: On Wed, Oct 06, 2004 at 08:00:57AM +0200, pginfo wrote: Hi, I tesetd the lower/upper support and cyrillic and it looks broken

Re: [GENERAL] Mirroring databases in v8

2004-10-06 Thread Tom Lane
Glen Eustace <[EMAIL PROTECTED]> writes: > Having read this, it would seem I might be jumping the gun a bit. The > method given could be used to copy a running database to another system > but I'm not sure how it would work if the mirrored database is required > to be online at the same time. It

[GENERAL] two digit years in inserts

2004-10-06 Thread Justin Wyer
I have this problem, I wrote a script to insert data into a table, one of the columns is a birthdate now I only have the last two year digits, and this all worked fine. Until I did a portupgrade (i am running on bsd 5.2.1 and 4.8 and postgresql 7.3.6 & 7.3.7 respectively) script worked fine bef

[GENERAL] (no subject)

2004-10-06 Thread Justin Wyer
subscribe ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Random not so random

2004-10-06 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Dann Corbit" <[EMAIL PROTECTED]> writes: > A better way would be to seed a Mersenne Twister PRNG at server startup > time and then use the same generator for all subsequent calls. > http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html > The period is exception

Re: OT: spherical geometry (Re: [GENERAL] earthdistance is not giving ...)

2004-10-06 Thread Holger Klawitter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I've never seen this, but at a guess it could mean starting with 0 at > one pole and counting to 180 at the other. Yes, that makes sense; thanks! But this scheme will certainly not be compatible to the distance fomula :-) Mit freundlichem Gruß / W

Re: [GENERAL] Mirroring databases in v8

2004-10-06 Thread Glen Eustace
On Wed, 2004-10-06 at 20:03, Shridhar Daithankar wrote: > Well, you could start off with PITR capabilities of 8.0. But you may need to > do quite a bit of customization and experimentation. > > Check http://developer.postgresql.org/docs/postgres/backup-online.html > > And we would be very eage

Re: [GENERAL] Mirroring databases in v8

2004-10-06 Thread Shridhar Daithankar
On Wednesday 06 Oct 2004 12:20 pm, Glen Eustace wrote: > I thought I had seen something that indicated that v8 was going to > provide a means to mirror databases without needing all the triggers > etc. I downloaded beta 3 but couldn't see anything that would do this. > > My goal is to mirror a data

OT: spherical geometry (Re: [GENERAL] earthdistance is not giving ...)

2004-10-06 Thread Holger Klawitter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sunday 03 October 2004 20:22, Bruno Wolff III wrote: > Latitudes greater than 90 degrees have a reasonable > meaning and it can be useful to use 0 to 180 instead of -90 to 90. Just a curious question: What is 100°N latitude supposed to mean? Mit f

Re: [GENERAL] lower/upper support and cyrillic

2004-10-06 Thread Holger Klawitter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I tesetd the lower/upper support and cyrillic and it looks broken. >[...] > Is it my mistake or realy pg do not support correctly lower and upper ? Yes, pg 7.x does not support upper/lower in UNICODE. This has been fixed in 8.0 Mit freundlichem Gr