Dennis Gearon | 1 May 2004 01:34

One or Both Foregin Keys

I am working on a design where a location for something can have:

    Fully qualified address with even building names, room numbers, and 
booth numbers.
**-OR-**
    GPS location
**-OR-**
    Both

Other than triggers, is there a way to enforce this using tables and 
primary keys?

I imagine an address table, and then

either a some sort of intermediate table,  in a one to many 
relationship, GPS to Addresses,
or the correct columns in the address table.

Either way, I don't see a normal way to enforce EITHER or BOTH without a 
trigger.

Thanks in Advance.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo <at> postgresql.org so that your
      message can get through to the mailing list cleanly

Sean Shanny | 1 May 2004 02:08
Picon
Favicon

Re: "out of memory" error

Rachel,

Most likely your data set coming back is too large to process all at 
once.  You need to set the fetch size on the statement to control the 
number of records coming back per request for them.

ps.setFetchSize( 100 );  where ps is a prepared statement.  The result 
set will use a cursor to only bring back 100 records at a time and will 
automatically fetch the next hundred until the entire result set has 
been brought back.

Make sure that your JDBC statements don't have a semi colon at the end 
of them otherwise the setFetchSize will be ignored and the entire result 
set will be returned at once.

--sean

Rachel McConnell wrote:

> Hello,
>
> I have a Java web application using Hibernate to connect to a 
> PostgreSQL backend.  I am seeing the below stack trace during 
> processing of a set of data consisting of around 1000 objects; for a 
> 200 object set I don't see the exception.
>
> I believe the salient point is the Out Of Memory bit - marked below by 
> *****'s
> The fact that this exception occurs during a call to 
> org.postgresql.util.PSQLException.parseServerError() seems disturbing 
(Continue reading)

Tom Lane | 1 May 2004 03:13
Picon

Re: One or Both Foregin Keys

Dennis Gearon <gearond <at> fireserve.net> writes:
> I am working on a design where a location for something can have:
>     Fully qualified address with even building names, room numbers, and 
> booth numbers.
> **-OR-**
>     GPS location
> **-OR-**
>     Both

> Other than triggers, is there a way to enforce this using tables and 
> primary keys?

Put foreign key constraints on the address and GPS loc (so that they
must be either valid or NULL) and then add a CHECK constraint saying
they can't both be NULL.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Alexander Cohen | 1 May 2004 16:10

pgsql folder and its contents

Hi,

Im looking to remove everyth9ing that is not absolutely necessary in 
the pgsql folder of my postgres server. Is there anyplace i can find 
information on what all the files in lib, share and bin are for? Im 
looking for somewhere or someone that can explain what each file 
contained in those folders is used for. I am experimenting already but 
i dont want to miss anything. Thanks.

--

-- 
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Keary Suska | 1 May 2004 19:30
Favicon

Vacuumdb Errors --Any ideas?

I received the following errors from an automated full vacuum:

vacuumdb: vacuuming of database "milemgr" failed: ERROR:  tuple concurrently
updated
ERROR: Vacuum command failed: Inappropriate ioctl for device

I can't find any information on these errors. Does anyone have an idea what
they mean and indicate?

[PG v7.4.2, RH 2.4.21-4.ELsmp]

TIA,

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Alexander Cohen | 1 May 2004 18:48

cionnected users to server

Is there a way to get the list of connected users to a postgres server?

--

-- 
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo <at> postgresql.org so that your
      message can get through to the mailing list cleanly

victor | 1 May 2004 20:05
Picon
Favicon

users rights per table

     I have to implement a structure of rights.
     I'm intrested if postgresql can restrict these operations(insert, update, select, delete) for a specified postgresql user.
     If this is possible, please tell me were could I find some documentation about this subject.
    
    Thank you.
Ryan Riehle | 1 May 2004 20:51

1 foreign key to 2 different tables?

Hi, 

I have a key structure like so:

 a		        c              b
+----------+    +---------+    +----------+  
| PriKey1  |--->| ForKey  |<---| PriKey2  |
|          |    | Flag    |    |          |
+----------+    +---------+    +----------+

...where c.ForKey is a value from PriKey1 OR PriKey2, which are different
values.  All fields have the same data type; a.PriKey1 and b.PriKey2 are
sequences. How does one enfore referential integrity in this structure so
that c.ForKey references a.PriKeya when Flag is True or references b.PriKey2
when Flag is False? Looked pretty hard through the lists and on Google last
night with no luck :(

  -Ryan Riehle
   http://www.buildways.com

KEYWORDS: one foreign key, multiple primary keys, multiple tables,
generalization, superclass, subclass, constraint

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo <at> postgresql.org

Mike Nolan | 1 May 2004 21:00
Picon

Re: users rights per table

>      I have to implement a structure of rights.
>      I'm intrested if postgresql can restrict these operations(insert, 
> update, select, delete) for a specified postgresql user.
>      If this is possible, please tell me were could I find some 
> documentation about this subject.

Can we assume that you have not yet read the section on 'GRANT'
in the online documentation on the postgreSQL website?
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo <at> postgresql.org so that your
      message can get through to the mailing list cleanly

Jean-Luc Lachance | 1 May 2004 21:29
Picon
Favicon

Re: 1 foreign key to 2 different tables?

Use CHECK when you create the table.

Ryan Riehle wrote:

> Hi, 
> 
> I have a key structure like so:
> 
>  a		        c              b
> +----------+    +---------+    +----------+  
> | PriKey1  |--->| ForKey  |<---| PriKey2  |
> |          |    | Flag    |    |          |
> +----------+    +---------+    +----------+
> 
> ...where c.ForKey is a value from PriKey1 OR PriKey2, which are different
> values.  All fields have the same data type; a.PriKey1 and b.PriKey2 are
> sequences. How does one enfore referential integrity in this structure so
> that c.ForKey references a.PriKeya when Flag is True or references b.PriKey2
> when Flag is False? Looked pretty hard through the lists and on Google last
> night with no luck :(
> 
>   -Ryan Riehle
>    http://www.buildways.com
> 
> KEYWORDS: one foreign key, multiple primary keys, multiple tables,
> generalization, superclass, subclass, constraint
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo <at> postgresql.org
> 

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org


Gmane