I want to put unique constraint on columns of more than one table.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of A. Kretschmer
Sent: Wednesday, December 10, 2008 6:04 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] unique constraint on views
In
In response to Jyoti Seth :
> Hi All,
>
> Is it possible to add unique constraint on updateable views in postgres?
Add the constraint to the base-table.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA
Hi All,
Is it possible to add unique constraint on updateable views in postgres?
Thanks,
Jyoti Seth
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
gry@ll.mit.edu (george young) writes:
> On 9 Feb 2006 08:22:59 -0800
> "BigSmoke" <[EMAIL PROTECTED]> threw this fish to the penguins:
>
>> If my tables have one or more UNIQUE constraints/indices, I still add a
>> "id SERIAL PRIMARY KEY" field to most of my tables. This makes
>> referencing easier
I mean that you can't easily base a foreign key constraint on a field
that is not NOT NULL UNIQUE.
- Rowan
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PRO
On 9 Feb 2006 08:22:59 -0800
"BigSmoke" <[EMAIL PROTECTED]> threw this fish to the penguins:
> If my tables have one or more UNIQUE constraints/indices, I still add a
> "id SERIAL PRIMARY KEY" field to most of my tables. This makes
> referencing easier and faster. It also improves consistency, whi
"BigSmoke" <[EMAIL PROTECTED]> writes:
> As far as I know, though, PRIMARY KEY does the same thing as UNIQUE NOT
> NULL in PostgreSQL.
They are 99.9% the same --- the *only* difference AFAIR is that PRIMARY
KEY establishes a default column-to-reference for FOREIGN KEY references
to the table. UNI
If my tables have one or more UNIQUE constraints/indices, I still add a
"id SERIAL PRIMARY KEY" field to most of my tables. This makes
referencing easier and faster. It also improves consistency, which is
never a bad thing in my opinion.
As far as I know, though, PRIMARY KEY does the same thing as
george young wrote:
On Wed, 08 Feb 2006 18:34:22 -0800
Ken Hill <[EMAIL PROTECTED]> threw this fish to the penguins:
On Wed, 2006-02-08 at 21:04 -0500, george young wrote:
So the 'steps' table is logically indexed by (run, opset_num, step_num).
But some opsets are not in runs, and some steps
On Wed, 08 Feb 2006 18:34:22 -0800
Ken Hill <[EMAIL PROTECTED]> threw this fish to the penguins:
> On Wed, 2006-02-08 at 21:04 -0500, george young wrote:
>
> > [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1]
> > I'm designing a completely new schema for my database. A ma
On Wed, 2006-02-08 at 21:04 -0500, george young wrote:
[PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1]
I'm designing a completely new schema for my database. A major
criterion is that it facilitate ad-hoc queries via MS-access, excel and
OpenOffice, presumably with O
[PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1]
I'm designing a completely new schema for my database. A major
criterion is that it facilitate ad-hoc queries via MS-access, excel and
OpenOffice, presumably with ODBC.
My question regards the use of UNIQUE constraints inste
Michael Glaesemann <[EMAIL PROTECTED]> writes:
> On Aug 7, 2004, at 3:25 AM, Sascha Ziemann wrote:
> > CREATE TABLE example (
> > a integer,
> > b integer,
> > c integer,
> > UNIQUE (a, c)
> > );
> >
> > But it is not clean to me. Does the above example mean that the list
> > of p
On Aug 7, 2004, at 3:25 AM, Sascha Ziemann wrote:
CREATE TABLE example (
a integer,
b integer,
c integer,
UNIQUE (a, c)
);
But it is not clean to me. Does the above example mean that the list
of pairs must be unique
Yes.
Does the following table fullfill the UNIQUE clause of the ex
Hi,
I have a question about the UNIQUE constraint. The documentation
describes this example:
CREATE TABLE example (
a integer,
b integer,
c integer,
UNIQUE (a, c)
);
But it is not clean to me. Does the above example mean that the list
of pairs must be unique or is it only a sho
> > or Can i have varchar types of size 50 as primary keys in Postgres.
> Yes. But unless the 50 character limit comes from a business rule, you
> might want to use the type 'text'.
And if that limit does come from a business rule you might want
to think twice whether using columns constrained by
On Tue, Feb 10, 2004 at 12:03:36 -0500,
[EMAIL PROTECTED] wrote:
> Hi all i am using postgres and torque
> I have a column x in Table A of type varchar and NOT NULL. I want to
> impose a unique key constraint on that table and column y is the primary
> key.
> I have another Table B with column x.
essage-
From: Jan Wieck [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 6:42 AM
To: Greg Patnude
Cc: [EMAIL PROTECTED]
Subject: Re: [SQL] Unique Constraint with foreign Key
Greg Patnude wrote:
> Pleas also note that the referenced column in the foreign table either
needs
> to be th
Greg Patnude wrote:
Pleas also note that the referenced column in the foreign table either needs
to be the PRIMARY KEY or have a unique constraint on it or maybe it just
requires an index on it -- I'm not sure but I discovered that if the column
in the foreign table (containing the REFERENCED key..
Pleas also note that the referenced column in the foreign table either needs
to be the PRIMARY KEY or have a unique constraint on it or maybe it just
requires an index on it -- I'm not sure but I discovered that if the column
in the foreign table (containing the REFERENCED key...) is NOT the primar
Hi all i am using postgres and torque
I have a column x in Table A of type varchar and NOT NULL. I want to
impose a unique key constraint on that table and column y is the primary
key.
I have another Table B with column x. can i make this column x as a
foreign key on column x in table A.
or Can i h
On Sat, 20 Sep 2003 18:55:34 -0400, Kevin Houle <[EMAIL PROTECTED]>
wrote:
> SELECT INTO result * FROM table_rates WHERE
> effective_date >= NEW.effective_date AND
> expiry_date <= NEW.expiry_date AND
> cost = NEW.cost;
> IF FOUND THEN
>RAISE EXCEPTION ''record ove
Andrew Milne wrote:
...
create table rates (
effective_date AS timestamp,
expiry_date AS timestamp,
cost AS numeric (12,2),
access_time AS integer (in minutes)
);
So for a given cost, there may not be a record where the effective date
of one record overlaps the expiry date of anothe
I'm looking to apply a unique constraint to a table such that field A
must be unique based on the date range from Field B to Field C.
This is for a rate based service model whereby, for example, $5 is worth
1 hour of Internet access. But next week, because of increased
competition, $5 is wort
Thrasher,
> I think I'll follow your advice, as this is the method that I had in my
> pocket to use if I had no response. I tried with TRIM and other
> functions in the CHECK constraint, but I guess that I cannot use
> functions over a check field.
>
> It surprised me, but anyway, I'll do th
Hi Josh,
I think I'll follow your advice, as this is the method that I had in my
pocket to use if I had no response. I tried with TRIM and other
functions in the CHECK constraint, but I guess that I cannot use
functions over a check field.
It surprised me, but anyway, I'll do that.
Thanks a
Thrasher,
> where type can be 's' for 'single' and 'x' for extended, so s should
> mean that there is only the type and data1 field, and x means that all
> fields are set.
>
> How can I set a unique constraint like CHECK (type = 's' AND UNIQUE
> (type, data1)) OR (type = 'x' AND UNIQUE (type
Hi all,
I have a table like
CREATE TABLE a (
typeCHAR (1) NOT NULL,
data1 CHAR (16) NOT NULL,
data2 CHAR (16) NULL
);
where type can be 's' for 'single' and 'x' for extended, so s should
mean that there is only the type and data1 field, and x means that all
fie
PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [ADMIN] [SQL] Urgent - SQL Unique constraint error (long)
On Mon, 19 Aug 2002, Darrin Domoney wrote:
> Thanks for the response but the answer is no. Owing to the
> ongoing issue with inherited tables in 7.x I have opted
On Mon, 19 Aug 2002, Darrin Domoney wrote:
> Thanks for the response but the answer is no. Owing to the
> ongoing issue with inherited tables in 7.x I have opted to create three
> tables:
> Contains generic traits regardless of "class or role".
> Person -> PK person_id
>
> Staff as certain
lf Of paul butler
Sent: August 19, 2002 1:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [NOVICE] Urgent - SQL Unique constraint error (long)
From: "Darrin Domoney" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
---Original Message-
From: Stephan Szabo [mailto:[EMAIL PROTECTED]]
Sent: August 19, 2002 12:41 PM
To: Darrin Domoney
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [SQL] Urgent - SQL Unique constraint error (long)
On Mon, 19 Aug 2002, Darrin Domoney wrote:
> An admitte
On Mon, 19 Aug 2002, Darrin Domoney wrote:
> An admitted newbie to postgresql I am trying to commit a new design
> my development server using pgAdminII.
>
> Everything appears to work OK but I am having real grief with my
> SQL generating errors - most of which I have cleared myself but
> one th
An admitted newbie to postgresql I am trying to commit a new design
my development server using pgAdminII.
Everything appears to work OK but I am having real grief with my
SQL generating errors - most of which I have cleared myself but
one that I am unsure how to handle:
UNIQUE constraint for
34 matches
Mail list logo