On 2010-12-13, Viktor Bojović wrote:
> --0015175cd20209e2030497532e39
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> Hi
> im trying to create foreign key constraint which checks not only the
> existence of key in foreign table, but it has to check if no
I see. Thanks for the tip.
Regards,
Fernando.
-Mensaje original-
De: Tom Lane [mailto:[EMAIL PROTECTED]
Enviado el: Miércoles, 20 de Junio de 2007 19:37
Para: Fernando Hevia
CC: 'PostgreSQL SQL List'
Asunto: Re: [SQL] Constraint exclusion
"Fernando Hevia" <[E
"Fernando Hevia" <[EMAIL PROTECTED]> writes:
> -- Constraints: one partition per month
> ALTER TABLE table_p01 ADD CONSTRAINT chk_table_p01_setuptime CHECK
> (EXTRACT(MONTH FROM setuptime) = 1::DOUBLE PRECISION);
The planner is not able to do anything with these constraints, other
than if there i
> > But if I want the next item following t=(a=10,b=100,c=1000):
>
> > select * from T
> > where (a=10 AND b=100 AND c>1000) OR (a=10 AND b>100) OR (a>10)
> > order by a,b,c;
>
> The correct way to handle this is to use a SQL-spec row comparison:
>
> where (a,b,c) > (10,100,1000)
>
> Unfortunate
"Stuart Brooks" <[EMAIL PROTECTED]> writes:
> But if I want the next item following t=(a=10,b=100,c=1000):
> select * from T
> where (a=10 AND b=100 AND c>1000) OR (a=10 AND b>100) OR (a>10)
> order by a,b,c;
The correct way to handle this is to use a SQL-spec row comparison:
where (a
> -Message d'origine-
> De : Michael Glaesemann [mailto:[EMAIL PROTECTED]
> Envoyé : samedi 1 juillet 2006 10:01
> À : Daniel CAUNE
> Cc : pgsql-sql@postgresql.org
> Objet : Re: [SQL] Constraint UNIQUE on a column not case sensitive
>
>
> On Jul 1, 200
Daniel CAUNE <[EMAIL PROTECTED]> writes:
> Hi,
>
> I would like to find an efficient solution for adding/implementing a
> constraint UNIQUE on a VARCHAR column not case sensitive:
>
> ALTER TABLE MyTable
> ADD CONSTRAINT UNQ_MyTable_MyColumn
> UNIQUE (lower(MyColumn)); -- invalid synt
On Jul 1, 2006, at 22:47 , Daniel CAUNE wrote:
The idea is to have an index on that column, in a not case
sensitive form, i.e. lower(MyColumn).
I think you're really close. Try
CREATE UNIQUE INDEX ci_mycolumn_idx ON mytable(lower(mycolumn));
Does that do what you're looking for?
Michael G
Hi, Andreas,
Andreas Joseph Krogh wrote:
>>CREATE UNIQUE INDEX foo ON onp_crm_businessfield_company(company_id)
>>WHERE is_prefferred;
> I also figured out that an index like this also works:
> UNIQUE(company_id, is_preferred)
> This works because NULL = NULL is false. But I guess your solution
On Thursday 18 May 2006 18:38, Markus Schaber wrote:
> Hi, Andreas,
>
> Andreas Joseph Krogh wrote:
> > create table onp_crm_businessfield_company(
> > businessfield_id integer not null references onp_crm_businessfield(id),
> > company_id integer not null references onp_crm_relation(id),
> > is_pre
Hi, Andreas,
Andreas Joseph Krogh wrote:
> create table onp_crm_businessfield_company(
> businessfield_id integer not null references onp_crm_businessfield(id),
> company_id integer not null references onp_crm_relation(id),
> is_preferred boolean,
> UNIQUE(businessfield_id, company_id)
> );
> I
Christian Paul B. Cosinas wrote:
Then I have a program that insert 1(one) million times like this:
Insert into unique_items(item_id) values('Item001)
Ofcourse we all know that it will fail because there is already a record in
the database.
Would there be any bad effect on the database or none
Daryl Richter wrote:
>> No. A constraint only applies to one row at a time. If you try to
>> work around
>> this by calling a function that does queries it isn't guarenteed to
>> work.
>> And if you are thinking of calling a function that does a query, you
>> aren't
>> looking at saving time ove
On Dec 29, 2005, at 2:16 AM, Bruno Wolff III wrote:
On Wed, Dec 28, 2005 at 00:52:18 +0700,
David Garamond <[EMAIL PROTECTED]> wrote:
Is it possible to use only CHECK constraint (and not triggers) to
completely enforce ordered value of a column (colx) in a table? By
that
I mean:
1. Rows
On Wed, Dec 28, 2005 at 00:52:18 +0700,
David Garamond <[EMAIL PROTECTED]> wrote:
> Is it possible to use only CHECK constraint (and not triggers) to
> completely enforce ordered value of a column (colx) in a table? By that
> I mean:
>
> 1. Rows must be inserted in the order of colx=1, then colx
Thanks.
I managed it via a trigger.
> -Original Message-
> From: Michael Fuhr [mailto:[EMAIL PROTECTED]
> Sent: Sonntag, 13. Februar 2005 02:57
> To: KÖPFERL Robert
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Constraint doesn't see a currently inserte
On Fri, Feb 11, 2005 at 07:10:50PM +0100, KÖPFERL Robert wrote:
> Another Idea was to make a trigger. But BTW how do I access a trigger
> parameter if my trigger function must not have any parameter??
PL/pgSQL triggers can access arguments via TG_ARGV.
http://www.postgresql.org/docs/8.0/
On Thu, 27 Jan 2005 13:44:32 +0200, Andrei Bintintan <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a table:
> CREATE TABLE werke1(
> id SERIAL,
> id_hr int4 NOT NULL,
> id_wk int4 NOT NULL
> );
>
> CREATE TABLE contact(
> id SERIAL,
> type varchar(20),
> );
>
>
> Now id_hr and id_wk are all referen
On Jan 27, 2005, at 6:44 AM, Andrei Bintintan wrote:
Hi,
I have a table:
CREATE TABLE werke1(
id SERIAL,
id_hr int4 NOT NULL,
id_wk int4 NOT NULL
);
CREATE TABLE contact(
id SERIAL,
type varchar(20),
);
It looks like you want a two-column primary key for table contact and
then you can refere
Dear Rod,
That sounds as good as simple ;) As for as patching, we do something like
that. Developed a PHP script that compares schema files (not dumps, but
source codes instead) to the actual. Say, it creates a temp table and
compares it to the existing one, examining pg_attributes, pg_indexes,
pg
On Tue, 2004-07-13 at 13:42, SZŰCS Gábor wrote:
> Dear Rod,
>
> Thanks. It'll be a pain to have two versions between the prod and devel
> servers, but I'll forward this info to the chief.
You can make this part easier on yourself.
Dump the structure from production and migrate it to devel (fix t
Dear Rod,
Thanks. It'll be a pain to have two versions between the prod and devel
servers, but I'll forward this info to the chief.
Thanks again,
G.
%--- cut here ---%
\end
- Original Message -
From: "Rod Taylor" <[EMAIL PROTECTED]>
Sent: Tuesday,
> Checked, and So do you say, this problem persists in dbs dumped from 7.4 to
> 7.4 too? i.e. upgrading to 7.4 (which we tested for quite some time now)
> won't help?
There may have been some minor fiddling to make it easier, but I
wouldn't call it fixed by any means.
> trying dump confirmed thi
ything.
G.
%--- cut here ---%
\end
- Original Message -
From: "Rod Taylor" <[EMAIL PROTECTED]>
Sent: Monday, July 12, 2004 2:51 PM
Subject: Re: [SQL] Constraint->function dependency and dump in 7.3
> On Mon, 2004-07-12 at 08:29, SZ
Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of SZŰCS Gábor
> Sent: 2004. július 12. 14:30
> To: [EMAIL PROTECTED]
> Subject: Re: [SQL] Constraint->function dependency and dump in 7.3
>
>
> Dear Fellow Countymen,
>
> I fear none of your
On Mon, 2004-07-12 at 08:29, SZŰCS Gábor wrote:
> Dear Fellow Countymen,
>
> I fear none of your answers are acceptable for me. Also, from Csaba's
> answer, this sounds to me more like a bug in pg_dump v7.3.
It is a bug (or a missing feature) that should be solved with v7.5 for
restoring to 7.5 o
Dear Fellow Countymen,
I fear none of your answers are acceptable for me. Also, from Csaba's
answer, this sounds to me more like a bug in pg_dump v7.3.
(1) I wish to transfer the full dump for daily mirroring. Thus, data-only
isn't an option.
(2) Dumping functions first won't work for SQL functi
L PROTECTED]
Subject: Re: [SQL] Constraint->function dependency and dump in 7.3
Hi Gábor!
I had the same problem and someone pointed me the right direction. I tried
to define a table default clause refering a function. Reloading the dump
file an error messaged raised up saying that the referred
Hi Gábor!
I had the same problem and someone pointed me the right direction. I tried
to define a table default clause refering a function. Reloading the dump
file an error messaged raised up saying that the referred function doesn't
exist.
This is because dumping out the schema pg_dump pushes out
On Fri, 27 Sep 2002 11:29:34 -0700 (PDT)
Stephan Szabo <[EMAIL PROTECTED]> wrote:
> On Fri, 27 Sep 2002, GB Clark wrote:
>
> > CREATE TABLE sysusers (
> > user_id INTEGER DEFAULT nextval('sysusers_user_id_seq')
> > UNIQUE NOT NULL PRIMARY K
On Fri, 27 Sep 2002, GB Clark wrote:
> CREATE TABLE sysusers (
> user_id INTEGER DEFAULT nextval('sysusers_user_id_seq')
> UNIQUE NOT NULL PRIMARY KEY,
> username text NOT NULL UNIQUE,
> password
Hi Ricardo,
I assume you're talking about foreign key constraints?
Dropping a constraint is a real pain in all versions of Postgres up to and
including 7.2.1.
You will need to manually drop the RI trigger on the child table and the two
triggers on the parent table.
Techdocs has some informatio
add an foriegn key on address(country_id), let country(id) be a primary
key.
Jie LIANG
St. Bernard Software
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
[EMAIL PROTECTED]
www.stbernard.com
www.ipinc.com
On Wed, 14 Feb 2001, Olaf Marc Za
From: "Olaf Marc Zanger" <[EMAIL PROTECTED]>
> hi there,
>
> with two tables i want to make some constraint-restrictions
>
> to make sure that now country-row is deleted if there is still a
country_id
> in address table.
>
> e.g.
>
> address: 1, 2, ...
> country: 2, ...
>
> now country wouldn't b
Bernie Huang wrote:
> Hi,
>
> I am a newbie to SQL. Could someone please explain why do I need a
> contraint, and how do I use it in SQL? An example is needed. Thanks
Constraints are used to have the database engine ensure the
integrity of the data. It'l like teaching the database it
35 matches
Mail list logo