Thomas Poty writes:
> I wanted to test if char and varchar can be cross-referenced as foreign
> key. So i did these tests :
> ...
> I thought the columns referring and referenced had to be the same data type
> with the same length but it seems not to be the case.
Looking into the code, I see that
Hi world,
I wanted to test if char and varchar can be cross-referenced as foreign
key. So i did these tests :
1) Can a varchar(7) reference a char(2) ? PostgreSQL accepts it
create table t1 (id char(2) primary key, data text);
create table t2 (id char(2) primary key, data text, id_t1 varchar(7)
r
On Feb 23, 2017 12:42 PM, "Ivan Voras" wrote:
Hello,
I've inherited a situation where:
- a table has both a primary key and a unique index on the same field.
- at some time, a foreign key was added which references this table
(actually, I'm not sure about the sequence of events), which
On 02/23/2017 03:40 AM, Ivan Voras wrote:
> Hello,
>
> I've inherited a situation where:
>
> * a table has both a primary key and a unique index on the same field.
> * at some time, a foreign key was added which references this table
> (actually, I'm not sure about the sequence of events
Hello,
I've inherited a situation where:
- a table has both a primary key and a unique index on the same field.
- at some time, a foreign key was added which references this table
(actually, I'm not sure about the sequence of events), which has ended up
referencing the unique index in
On Tue, Aug 23, 2016 at 1:07 PM, Igor Neyman wrote:
>
>
> *From:* pgsql-general-ow...@postgresql.org [mailto:pgsql-general-owner@
> postgresql.org] *On Behalf Of *Craig James
> *Sent:* Tuesday, August 23, 2016 4:00 PM
> *To:* pgsql-general@postgresql.org
> *Subject:*
On 08/23/2016 01:00 PM, Craig James wrote:
How do you create a foreign key that references a partitioned table?
I'm splitting a large table "molecules" into 20 partitions, which also
has an associated "molecular_properties" table. It looks something like
this (pseudo-code):
create table mol
I have wondered if there were any plans to enhance fkey support for
partitioned tables now that more work is being done on partitioning (I know
there has been a large thread on declarative partitioning on hackers,
though I haven't followed it too closely).
Foreign keys are all done through trigger
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Craig James
Sent: Tuesday, August 23, 2016 4:00 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Foreign key against a partitioned table
How do you create a foreign key that references a
How do you create a foreign key that references a partitioned table?
I'm splitting a large table "molecules" into 20 partitions, which also has
an associated "molecular_properties" table. It looks something like this
(pseudo-code):
create table molecules(molecule_idinteger primary key,
On Thu, Aug 18, 2016 at 1:10 PM, Mark Lybarger wrote:
> I have two tables that i want to link with a FK where the child table record
> is "active".
>
> some googling shows that i could use a function and a check constraint on
> the function, but that only works for inserts, not updates on table b.
My first instinct would be to look into triggers. In addition to an FK
a(b_id) -> b(id), you could have an insert and update trigger on
a(b_id) and b(active) to ensure the additional constraints.
On Thu, Aug 18, 2016 at 1:10 PM, Mark Lybarger wrote:
> I have two tables that i want to link with a
I have two tables that i want to link with a FK where the child table
record is "active".
some googling shows that i could use a function and a check constraint on
the function, but that only works for inserts, not updates on table b.
create table a (int id, text name);
create table b (int id, bo
Yes, foreign keys are implemented using triggers. Here is a blog post
explaining a little more:
http://bonesmoses.org/2014/05/14/foreign-keys-are-not-free/
I would assume it's still got to do a seq scan even on every referencing
table even if it's empty for every record since there are no indexes.
Hi,
I was trying to clean a database by deleting records of some of its tables.
But in our model we have a table that is heavily referenced, that is, many
tables reference this particular table by foreign key constraints. We don't
have foreign key indexes, so executing a delete from mytable takes
Hi all,
I have a feature request for our dear fellow developpers : I would like to
be able to create a foreign key constraint that references a view (or
anything that looks like a table, as a function returning a table for
instance) instead of a table.
Does that look doable ? The trickiest part i
On 22/02/2016 13:03, Chris Withers wrote:
Hi All,
So, I have a table that looks like this:
CREATE TABLE config (
regionvarchar(10),
namevarchar(10),
valuevarchar(40)
);
Another looks like this:
CREATE TABLE tag (
hostvarchar(10),
typevarchar(10),
va
Hi All,
So, I have a table that looks like this:
CREATE TABLE config (
region varchar(10),
name varchar(10),
value varchar(40)
);
Another looks like this:
CREATE TABLE tag (
host varchar(10),
Hi all,
I've discovered one of our databases has managed to get into a state where
it is violating a foreign key constraint.
The facts are these:
Table B (row_id) references Table A (row_id).
Table B contains multiple row_id's that do not exist in Table A.
There also exists a BEFORE INSERT OR UP
Apologies for not replying sooner. After a few days, we actually found out
the cause was a user turning off all triggers on the table, forcing some
data into it to try and solve an RMA issue manually, then turning the
triggers back on. This hadn't showed up on any logs, and after finding zero
signs
Em 29-05-2013 12:51, Vick Khera escreveu:
On Wed, May 29, 2013 at 9:58 AM, Rodrigo Rosenfeld Rosas
mailto:rr.ro...@gmail.com>> wrote:
I know I could use a trigger, or some check constraint maybe, to
ensure the field exists upon insert (or update), but I can't
ensure the database w
On Wed, May 29, 2013 at 9:58 AM, Rodrigo Rosenfeld Rosas wrote:
> I know I could use a trigger, or some check constraint maybe, to ensure
> the field exists upon insert (or update), but I can't ensure the database
> will become inconsistent in case I remove a mapped field from the other
> schema.
On 23 May 2013 15:33, Thom Brown wrote:
> On 23 May 2013 10:15, Keith Fiske wrote:
>> Client reported an issue where it appears a foreign key has been violated
>>
>> prod=#\d rma_items
>> [snip]
>> rma_items_rma_id_status_fk" FOREIGN KEY (rma_id, rma_status) REFERENCES
>> rmas(id, status) ON UPDA
Sorry, I wasn't sure what list I should be sending this question to...
I have a multi-tenant-like application. We have a fields tree that we
call a template, with something like this:
fields(id, parent_id, name)
And several other related tables. Since we started to support multiple
templates
Hi,
I'm not sure if I understand your issue, but could you output
SELECT
COUNT(*)
FROM rmas
WHERE
id = 1008122437
AND status = 'r';
HTH
Kind regards/met vriendelijke groet,
Serge Fonville
http://www.sergefonville.nl
Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
On 23 May 2013 10:15, Keith Fiske wrote:
> Client reported an issue where it appears a foreign key has been violated
>
> prod=#\d rma_items
> [snip]
> rma_items_rma_id_status_fk" FOREIGN KEY (rma_id, rma_status) REFERENCES
> rmas(id, status) ON UPDATE CASCADE ON DELETE CASCADE
>
> prod=# select i.
Client reported an issue where it appears a foreign key has been violated
prod=#\d rma_items
[snip]
rma_items_rma_id_status_fk" FOREIGN KEY (rma_id, rma_status) REFERENCES
rmas(id, status) ON UPDATE CASCADE ON DELETE CASCADE
prod=# select i.rma_id, i.rma_status, r.id, r.status from rmas r join
rm
Hi Rafal,
Il 24/09/12 07:54, Rafal Pietrak ha scritto:
I did what I could - the review is on the hackers list.
Thanks! That's much appreciated.
Should I do anything else to finilize this review, like "linking" it
to the pending patch? somehow? -R
You should update the commitfest.postgresq
On Tue, 2012-09-18 at 09:37 +0200, Albe Laurenz wrote:
> Rafal Pietrak wrote:
> > On Mon, 2012-09-17 at 14:31 -0500, Merlin Moncure wrote:
> > > On Mon, Sep 17, 2012 at 7:24 AM, Rafal Pietrak
> > > wrote:
[]
> >
> > Who can review that patch?
>
> You :^)
>
I did what I could - the r
On Thu, Sep 20, 2012 at 12:18 AM, Gabriele Bartolini <
gabriele.bartol...@2ndquadrant.it> wrote:
> Hi Chris,
>
>thank you very much for taking the time to read the article and get
> into the features proposed with our patch.
You are welcome. Also in case there is ambiguity, the feature I wa
Hi Chris,
thank you very much for taking the time to read the article and get
into the features proposed with our patch.
On Tue, 18 Sep 2012 17:17:56 -0700, Chris Travers
wrote:
So those are the cautions and why I don't think a feature like this
is suitable for routine usage, but truth b
On Tue, 2012-09-18 at 18:39 -0400, Tom Lane wrote:
> Rafal Pietrak writes:
> > postmaster/postmaster.o: In function `PostmasterMain':^M
> > postmaster.c:(.text+0x4bc8): undefined reference to `optreset'^M
> > tcop/postgres.o: In function `process_postgres_switches':^M
> > postgres.c:(.text+0x1422)
Ciao Rafal,
You can download the refreshed version of the patch:
http://archives.postgresql.org/message-id/1347983571.11539.14.ca...@greygoo.devise-it.lan
5. where do I get current-v9.3 from?
git clone git://git.postgresql.org/git/postgresql.git
cd postgresql
git checkout -b aefk
bzcat Arra
On Tue, Sep 18, 2012 at 6:12 AM, Gabriele Bartolini <
gabriele.bartol...@2ndquadrant.it> wrote:
> Hi Rafal,
>
> Il 18/09/12 13:00, Rafal Pietrak ha scritto:
>
> I did have a look, and feel slightly encouraged reading: "Many people
>> feel that they're not qualified"; yes, that's me all right. Ser
Rafal Pietrak writes:
> postmaster/postmaster.o: In function `PostmasterMain':^M
> postmaster.c:(.text+0x4bc8): undefined reference to `optreset'^M
> tcop/postgres.o: In function `process_postgres_switches':^M
> postgres.c:(.text+0x1422): undefined reference to `optreset'^M
> utils/misc/ps_status.
On Tue, 2012-09-18 at 15:38 -0500, Kevin Grittner wrote:
> Rafal Pietrak wrote:
> > where do I get current-v9.3 from?
>
> At this point 9.3 just means the HEAD of the master branch of the
> git repository, which is where development for the next major
> release of software is always done. For d
Rafal Pietrak wrote:
> where do I get current-v9.3 from?
At this point 9.3 just means the HEAD of the master branch of the
git repository, which is where development for the next major
release of software is always done. For details of the public git
repository see:
http://git.postgresql.org/
Hi,
On Tue, 2012-09-18 at 15:12 +0200, Gabriele Bartolini wrote:
> Hi Rafal,
[]
>
> It is such a coincidence that yesterday I had started to write this
> article
> (http://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys/)
>
> about this feature for 9.3
Hi Rafal,
Il 18/09/12 13:00, Rafal Pietrak ha scritto:
I did have a look, and feel slightly encouraged reading: "Many people
feel that they're not qualified"; yes, that's me all right. Serously,
I will try to do by best ... by the weekend, when I get some spare time.
It is such a coincidence
On Tue, 2012-09-18 at 09:37 +0200, Albe Laurenz wrote:
> Rafal Pietrak wrote:
[--]
> >
> > Who can review that patch?
>
> You :^)
;7
OK. (still smiling a little)
[---]
> Here is information about what is required:
> http://wiki.postgresql.org/wiki/Reviewing_a_Patch
On Tue, Sep 18, 2012 at 12:37 AM, Albe Laurenz wrote:
>
>
> You :^)
>
> The list of patches for the commitfest is here:
> https://commitfest.postgresql.org/action/commitfest_view?id=15
>
> There is no reviewer for "Array ELEMENT Foreign Keys" yet.
>
> Silly question perhaps better saved for the re
Rafal Pietrak wrote:
> On Mon, 2012-09-17 at 14:31 -0500, Merlin Moncure wrote:
> > On Mon, Sep 17, 2012 at 7:24 AM, Rafal Pietrak
> > wrote:
> > > On Mon, 2012-09-17 at 19:58 +0800, Craig Ringer wrote:
> > >> On 09/17/2012 04:46 PM, Rafal Pietrak wrote:
> > > [--]
> > >> There was so
On Mon, 2012-09-17 at 14:31 -0500, Merlin Moncure wrote:
> On Mon, Sep 17, 2012 at 7:24 AM, Rafal Pietrak
> wrote:
> > On Mon, 2012-09-17 at 19:58 +0800, Craig Ringer wrote:
> >> On 09/17/2012 04:46 PM, Rafal Pietrak wrote:
> > [--]
> >> There was some quite recent discussion on ELEME
On Mon, Sep 17, 2012 at 7:24 AM, Rafal Pietrak wrote:
> On Mon, 2012-09-17 at 19:58 +0800, Craig Ringer wrote:
>> On 09/17/2012 04:46 PM, Rafal Pietrak wrote:
> [--]
>> There was some quite recent discussion on ELEMENT foreign keys on the
>> -hackers list. Try searching pgsql-hackers f
On Mon, 2012-09-17 at 19:58 +0800, Craig Ringer wrote:
> On 09/17/2012 04:46 PM, Rafal Pietrak wrote:
[--]
> There was some quite recent discussion on ELEMENT foreign keys on the
> -hackers list. Try searching pgsql-hackers for ELEMENT foreign key.
>
> See:
>https://commitfest.pos
On 09/17/2012 04:46 PM, Rafal Pietrak wrote:
Hello the list,
recently I'm cooking a database for an application, that I feel is best
implemented with tables containing arrays.
I have found some related info here:
http://archives.postgresql.org/pgsql-hackers/2008-09/msg01356.php
although the in
Hello the list,
recently I'm cooking a database for an application, that I feel is best
implemented with tables containing arrays.
I have found some related info here:
http://archives.postgresql.org/pgsql-hackers/2008-09/msg01356.php
although the initial advice in that thread was: not to use ar
On Jan 8, 2012, at 9:33, Phoenix Kiula wrote:
> Hi. Hope I'm articulating the question correctly.
>
> I currently have a foreign key like this:
>
>"fk_table2" FOREIGN KEY (id) REFERENCES table1(id) ON DELETE CASCADE;
>
> Given the peculiar needs of this db, it seems that in some cases we
>
Hi. Hope I'm articulating the question correctly.
I currently have a foreign key like this:
"fk_table2" FOREIGN KEY (id) REFERENCES table1(id) ON DELETE CASCADE;
Given the peculiar needs of this db, it seems that in some cases we
will need to track the "id" of table2 against a concatenation
On Mon, Sep 12, 2011 at 6:48 PM, Phoenix Kiula wrote:
> I have a column in my table:
> user_id varchar(100) ;
>
> This can be NULL, or it can have a value. If it has a value during
> INSERT or UPDATE, I want to check that the user exists against my
> "Users" table. Otherwise, NULL is ok. (Bec
hi, fks do just that.
you can create your fk with just one command:
alter table xxx add constraint fk_name foreign key (user_id) references
users (id);
parent table's id field should also be of the same type and also it should
be primary key or at least unique.
you can create your pk with (if you
Hi,
I bet this is a simple solution but I have been racking my brains.
I have a column in my table:
user_id varchar(100) ;
This can be NULL, or it can have a value. If it has a value during
INSERT or UPDATE, I want to check that the user exists against my
"Users" table. Otherwise, NULL is
In your example can you Make cx.r a foreign key on another table (say real) so
that a valid instance of cx must have a value for r that exists in real? I
guess you could make r an enum but that wouldn't readily allow you to modify
the allowable values for r. A domain and/or check constraint fo
Vincent De Groote writes:
> I have a composite type with 2 fields. I would like to check that one
> of these fields exists in another table.
> Foreign keys on a composite field does not seem to be supported.
Works for me, in 8.4 and up. Whether it's a good idea is a different
issue (I think it'
Hello,
I have a composite type with 2 fields. I would like to check that one
of these fields exists in another table.
Foreign keys on a composite field does not seem to be supported.
Is there another way to do that ?
Thanks for your reply
Vincent De Groote
On Mon, Apr 4, 2011 at 4:18 PM, Edoardo Serra wrote:
> At this point, client1 gives the following error:
> ERROR: could not serialize access due to concurrent update
> CONTEXT: SQL statement "SELECT 1 FROM ONLY "public"."people" x WHERE "id"
> OPERATOR(pg_catalog.=) $1 FOR SHARE OF x"
>
> Is th
On 04/05/2011 04:18 AM, Edoardo Serra wrote:
Hi guys,
I have a problem with the implicit "FOR SHARE" lock which postgres seems to get
on the referenced record when there is a foreign key.
I'm using postgres 8.3.3 from debian packages.
[snip]
At this point, client1 gives the following error:
Hi guys,
I have a problem with the implicit "FOR SHARE" lock which postgres seems to get
on the referenced record when there is a foreign key.
I'm using postgres 8.3.3 from debian packages.
Here is a sample database structure and commands to reproduce.
-- Test database structure
CREATE TABLE p
2010/4/23 Bob Pawley
> Hi
>
> I don't understand what the following error means.
>
> I am trying to add a foreign key to table image, that holds column
> device_id. This is to be controlled by column devices_id in table devices.
>
> ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (add
Hi
I don't understand what the following error means.
I am trying to add a foreign key to table image, that holds column device_id.
This is to be controlled by column devices_id in table devices.
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES
addresses (address
On 05/03/10 18:12, Mridula Mahadevan wrote:
Richard, To answer your questions, I have a live application that is
running on postgresql. We are seeing this issue on certain
installations and not on others. So the code is no different in each
set up. I also added the trigger to table B and then the
-
From: Richard Huxton [mailto:d...@archonet.com]
Sent: Friday, March 05, 2010 1:27 AM
To: Mridula Mahadevan
Cc: Tom Lane; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Foreign key behavior different in a function and outside
On 05/03/10 06:45, Mridula Mahadevan wrote:
> Thanks for the respo
On 05/03/10 06:45, Mridula Mahadevan wrote:
Thanks for the response Tom. I am running postgres 8.3.7.
Yes, his is a highly simplified version, but I also didn't get the
column name right.
The core issue is the foreign key reference being deleted even though
there is no cascade delete defined.
Lane [mailto:t...@sss.pgh.pa.us]
Sent: Thursday, March 04, 2010 7:45 PM
To: Mridula Mahadevan
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Foreign key behavior different in a function and outside
Mridula Mahadevan writes:
> CREATE OR REPLACE FUNCTION delete_B(id integer)
> RETU
Mridula Mahadevan writes:
> CREATE OR REPLACE FUNCTION delete_B(id integer)
> RETURNS void AS
> $BODY$
> declare
> vSql varchar;
> BEGIN
> delete from B where id = id;
> END;
That's a really dangero
I have 3 tables say A, B, C
CREATE TABLE A
(
A_id integer NOT NULL,
CONSTRAINT A_pkey PRIMARY KEY (A_id)
)
;
CREATE TABLE B
(
B_id serial NOT NULL,
A_id integer NOT NULL,
CONSTRAINT B_pkey PRIMARY KEY (B_id),
CONSTRAINT fkd08b6eeeb4f3a730 FOREIGN KEY (A_id)
REFERENCES A(A_id) MATC
Belka Lambda writes:
> Is there a way to construct FOREIGN KEYs from parts of composite-typed field?
No, and even if the system let you do it, the performance would probably
suck. Composite-type fields are not something to be used with abandon.
To me your example looks like a design pattern to
Hi everyone!
Is there a way to construct FOREIGN KEYs from parts of composite-typed field?
The code returns an error:
-
create table aaa (
a_id integer primary key,
a_str varchar)
;
create type content_of_bbb (a_id integer, b_str varchar);
create table b
On Thu, 6 Aug 2009, Paul Rogers wrote:
> Why does the attached script fail with a foreign key constraint violation?
Referential actions are not deferred when a constraint is marked
deferrable (as that appears to be what the spec wants), so ON DELETE
RESTRICT will still fail on the statement, whil
Paul Rogers writes:
> Why does the attached script fail with a foreign key constraint violation?
The ON DELETE RESTRICT is why. Per the fine manual:
[RESTRICT] is the same as NO ACTION except that the check is not
deferrable.
It's a bit odd, but that's the best interpretation w
Why does the attached script fail with a foreign key constraint violation?
Privileged/Confidential Information may be contained in this message.
If you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
Vlado Moravec writes:
> from postgres docs: "foreign key must reference columns that either are a
> primary key or form a unique constraint". It does not allow creating foreign
> key constraint on non-unique column - an error is raised.
> After playing with a new database I discovered that such a
On Mon, Jun 8, 2009 at 11:48 AM, Vlado Moravec wrote:
> Hi,
> from postgres docs: "foreign key must reference columns that either are a
> primary key or form a unique constraint". It does not allow creating foreign
> key constraint on non-unique column - an error is raised.
> After playing with a n
Hi,
from postgres docs: "foreign key must reference columns that either are a
primary key or form a unique constraint". It does not allow creating foreign
key constraint on non-unique column - an error is raised.
After playing with a new database I discovered that such a unique constraint
can be dr
On Jun 3, 1:04 am, wmo...@potentialtech.com (Bill Moran) wrote:
> In response to Dave Clarke :
>
>
>
>
>
> > I have a table that I'm trying to refactor and I'm by no means a SQL
> > expert (apologies if I'm posting to the wrong group). The table in
> > question has a column that allows NULLs. I wan
In response to Dave Clarke :
>
> I have a table that I'm trying to refactor and I'm by no means a SQL
> expert (apologies if I'm posting to the wrong group). The table in
> question has a column that allows NULLs. I want to move that column
> into a separate table and set up a FK reference back to
Hi Dave,
that makes sense. You should read the documentation about FK. They can
be 1:n, 1:1, n:1. Normally i would make a unique field in each table to
avoid complex PK/FK. Eg a serial column.
Dave Clarke schrieb:
Hello
I have a table that I'm trying to refactor and I'm by no means a SQL
ex
Hello
I have a table that I'm trying to refactor and I'm by no means a SQL
expert (apologies if I'm posting to the wrong group). The table in
question has a column that allows NULLs. I want to move that column
into a separate table and set up a FK reference back to the original
table. My question
Hi Tom,
Thank you for pointing out the condition under which this occurs, I
had not made the connection that the check was only occurring when the
value in the other columns with foreign keys are null. I agree 100%
that a strict key equality check that is in general use in the
database should not r
j-lists writes:
> I have an update statement that affects every row in a given table.
> For that table it changes the value in a single column, which itself
> has a foreign key constraint. The table has an additional 9 foreign
> keys, some of which reference large tables.
> My expectation would be
I have an update statement that affects every row in a given table.
For that table it changes the value in a single column, which itself
has a foreign key constraint. The table has an additional 9 foreign
keys, some of which reference large tables.
My expectation would be that only the changed colu
Erwin Moller schreef:
Craig Ringer schreef:
Erwin Moller wrote:
No, that is not the kind of chicken I was talking about. ;-)
My chicken is more along these lines:
I often have some tables to which everything is related (eg
tblcourse that contains everything belonging to a certain course).
I d
Hi Pavel,
Thanks for that.
But I already wrote a nice extension to my DB-class in PHP that uses
Thomas Kellerer's approach.
It was simple once you know how to retrieve the info from the
systemtables. :-)
Regards,
Erwin Moller
Pavel Stehule schreef:
Hello
I used this code
CREATE OR REPLAC
Craig Ringer schreef:
Erwin Moller wrote:
No, that is not the kind of chicken I was talking about. ;-)
My chicken is more along these lines:
I often have some tables to which everything is related (eg tblcourse
that contains everything belonging to a certain course).
I don't want to make a sin
Erwin Moller wrote:
No, that is not the kind of chicken I was talking about. ;-)
My chicken is more along these lines:
I often have some tables to which everything is related (eg tblcourse
that contains everything belonging to a certain course).
I don't want to make a single simple mistake that
Hello
I used this code
CREATE OR REPLACE FUNCTION list_user_tables_sort_depend
(owner VARCHAR, revers BOOLEAN) RETURNS SETOF VARCHAR AS '
DECLARE tabulky VARCHAR[]; i INTEGER; opakovat BOOLEAN = ''t'';
pom VARCHAR; exportovano VARCHAR[] = ''{}''; r RECORD;
mohu_exportovat BOOLEAN;
BEGIN SELE
Shane Ambler schreef:
ries van Twisk wrote:
On Nov 18, 2008, at 9:47 AM, Erwin Moller wrote:
Hi group,
Considering following (simplified) example:
Suppose I want to delete a record in tblnr1.
Does Postgres has some command/procedure/function to list tables
that have FK constraints on th
ries van Twisk wrote:
On Nov 18, 2008, at 9:47 AM, Erwin Moller wrote:
Hi group,
Considering following (simplified) example:
Suppose I want to delete a record in tblnr1.
Does Postgres has some command/procedure/function to list tables that
have FK constraints on that table (tblnr1)
The
Thomas Kellerer schreef:
Erwin Moller, 18.11.2008 15:47:
Suppose I want to delete a record in tblnr1.
Does Postgres has some command/procedure/function to list tables that
have FK constraints on that table (tblnr1)
That could be resolved with a query against the INFORMATION_SCHEMA
Something
ries van Twisk schreef:
On Nov 18, 2008, at 9:47 AM, Erwin Moller wrote:
Hi group,
Considering following (simplified) example:
CREATE TABLE tblnr1(
nr1id SERIAL PRIMARY KEY,
firstname TEXT
);
CREATE TABLE tblnr2(
nr2id SERIAL PRIMARY KEY,
nr1id INTEGER REFERENCES tblnr1(nr1id)
);
CREATE TABL
Erwin Moller, 18.11.2008 15:47:
Suppose I want to delete a record in tblnr1.
Does Postgres has some command/procedure/function to list tables that
have FK constraints on that table (tblnr1)
That could be resolved with a query against the INFORMATION_SCHEMA
Something like
SELECT c.table_name
On Nov 18, 2008, at 9:47 AM, Erwin Moller wrote:
Hi group,
Considering following (simplified) example:
CREATE TABLE tblnr1(
nr1id SERIAL PRIMARY KEY,
firstname TEXT
);
CREATE TABLE tblnr2(
nr2id SERIAL PRIMARY KEY,
nr1id INTEGER REFERENCES tblnr1(nr1id)
);
CREATE TABLE tblnr3(
nr3id SERIAL P
Hi group,
Considering following (simplified) example:
CREATE TABLE tblnr1(
nr1id SERIAL PRIMARY KEY,
firstname TEXT
);
CREATE TABLE tblnr2(
nr2id SERIAL PRIMARY KEY,
nr1id INTEGER REFERENCES tblnr1(nr1id)
);
CREATE TABLE tblnr3(
nr3id SERIAL PRIMARY KEY,
nr2id INTEGER REFERENCES tblnr2(n
Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand
>>> Jorge Godoy <[EMAIL PROTECTED]> 09/17/08 1:36 AM >>>
Em Monday 15 September 2008 19:05:25 [EMAIL PROTECTED] escreveu:
> Hi,
>
> I need a foreign key (or equivalent) where the referenced table cannot have
> a unique constraint.
>
> For f
On Tue 02 Sep 2008 05:35:25 PM EDT, D. Dante Lorenso wrote:
> You could add a trigger to your product_location table that just
> double-checked the customers matched or prevents the insert/update. A
> PL/PGSQL function like this might help:
>
> -- 8< 8< --
>
Matthew Wilson wrote:
On Tue 02 Sep 2008 04:40:55 PM EDT, Scott Marlowe wrote:
On Tue, Sep 2, 2008 at 2:35 PM, Matthew Wilson <[EMAIL PROTECTED]> wrote:
On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
If the two subordinate tables ALWAYS have to point to the same place,
why two tables
,
location_id int references location (id) );
Jon
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:pgsql-general-
> [EMAIL PROTECTED] On Behalf Of Matthew Wilson
> Sent: Tuesday, September 02, 2008 3:35 PM
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Foreign
On Tue 02 Sep 2008 04:40:55 PM EDT, Scott Marlowe wrote:
> On Tue, Sep 2, 2008 at 2:35 PM, Matthew Wilson <[EMAIL PROTECTED]> wrote:
>> On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
>>> If the two subordinate tables ALWAYS have to point to the same place,
>>> why two tables? Can't a cus
On Tue, Sep 2, 2008 at 2:35 PM, Matthew Wilson <[EMAIL PROTECTED]> wrote:
> On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
>> If the two subordinate tables ALWAYS have to point to the same place,
>> why two tables? Can't a customer have > 1 location? I'm pretty sure
>> IBM has more than
On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
> If the two subordinate tables ALWAYS have to point to the same place,
> why two tables? Can't a customer have > 1 location? I'm pretty sure
> IBM has more than one corporate office you could ship things to.
Yeah, so the idea is one custo
1 - 100 of 276 matches
Mail list logo