Sorry... I completely forgot about this one. I actually did some research on that before in relation to CAY-116, and even wrote some code to drop constraints using FK_NAME (although it does not work for all DB's):

https://svn.apache.org/repos/asf/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/AccessStackAdapter.java

Andrus

On Dec 19, 2007, at 3:20 PM, Tore Halset wrote:

On Dec 19, 2007, at 12:36 , Andrus Adamchik wrote:

Hmm... I thought FK_NAME was a column name of the FK?

Example from cayenne junit db in PostgreSQL:

cayenne=> \d painting
                 Table "public.painting"
       Column        |          Type          | Modifiers
----------------------+------------------------+-----------
artist_id            | integer                |
estimated_price      | numeric(10,2)          |
gallery_id           | integer                |
painting_description | character varying(255) |
painting_id          | integer                | not null
painting_title       | character varying(255) | not null
Indexes:
   "painting_pkey" PRIMARY KEY, btree (painting_id)
Foreign-key constraints:
"painting_artist_id_fkey" FOREIGN KEY (artist_id) REFERENCES artist(artist_id) "painting_gallery_id_fkey" FOREIGN KEY (gallery_id) REFERENCES gallery(gallery_id)

Here "painting_artist_id_fkey" and "painting_gallery_id_fkey" are FK_NAMEs. Those are needed only when you want to drop the foreign key.

Regards,
- Tore.



Reply via email to