[Re: [SQL] PRIMARY KEY]

2007-03-08 Thread Phillip Smith
If you actually need to know the value of N_GEN in your ASP application, you will need to query the database first and select the NEXTVAL from the sequence that the "serial" data type will create, then use that returned value in your insert - ie, DON'T exclude it from the insert, otherwise it will

Re: [SQL] PRIMARY KEY

2007-03-07 Thread Shavonne Marietta Wijesinghe
PM Subject: Re: [SQL] PRIMARY KEY Hello, Is it possible to redesign your table as follows: create table Mod48_00_2007 ( IDtext, N_GEN serial not null, FORMSTORE text, COD_NOTATIO text, PA_COGNOMEtext, constraint pk_Mod48_00_2007 primary key

Re: [SQL] PRIMARY KEY

2007-03-07 Thread M.P.Dankoor
Phillip Smith wrote: If you actually need to know the value of N_GEN in your ASP application, you will need to query the database first and select the NEXTVAL from the sequence that the "serial" data type will create, then use that returned value in your insert - ie, DON'T exclude it from the

Re: [SQL] PRIMARY KEY

2007-03-07 Thread M.P.Dankoor
Hello, Is it possible to redesign your table as follows: create table Mod48_00_2007 ( IDtext, N_GEN serial not null, FORMSTORE text, COD_NOTATIO text, PA_COGNOMEtext, constraint pk_Mod48_00_2007 primary key (N_GEN) ); Your insert simply becomes: INSERT INTO MOD

Re: [SQL] PRIMARY KEY

2007-03-07 Thread Richard Huxton
Shavonne Marietta Wijesinghe wrote: Hello I have created a table CREATE TABLE MOD48_00_2007 ( ID text, N_GEN int PRIMARY KEY, FORMSTORE text, COD_NOTAIO text, PA_COGNOME text); And i insert the rows via a form in ASP. When the form loads i have a functin that goes and gets the value of the fi

[SQL] PRIMARY KEY

2007-03-07 Thread Shavonne Marietta Wijesinghe
Hello I have created a table CREATE TABLE MOD48_00_2007 ( ID text, N_GEN int PRIMARY KEY, FORMSTORE text, COD_NOTAIO text, PA_COGNOME text); And i insert the rows via a form in ASP. When the form loads i have a functin that goes and gets the value of the field N_GEN adds 1 to it and shows it to

Re: [SQL] Primary key constraint violation without error?

2006-07-24 Thread Michael Fuhr
On Mon, Jul 24, 2006 at 02:12:39PM +0200, Mario Splivalo wrote: > Now I run the function again: > > l_netsms=# select punimessages(); > NOTICE: Ubacili smo za usera 4162. > NOTICE: Ubacili smo za usera 4161. > NOTICE: Ubacili smo za usera 4160. > NOTICE: Ubacili smo za usera 4159. > NOTICE: U

Re: [SQL] Primary key constraint violation without error?

2006-07-24 Thread Richard Huxton
Mario Splivalo wrote: Actually it's not violation, but I get no error message on violating it... CREATE OR REPLACE FUNCTION punimessages() RETURNS bool AS $BODY$ declare userId users%ROWTYPE; begin truncate table mes_del; ^^^ This at the star

[SQL] Primary key constraint violation without error?

2006-07-24 Thread Mario Splivalo
Actually it's not violation, but I get no error message on violating it... The story is like this. I have few tables from where I extract messageIds for particular users. Then, last 100 messages for each user I transfer to spare table, to do something with that. That spare table has strange behavi

Re: [SQL] Primary key reference count

2006-04-23 Thread Wiebe Cazemier
On Wednesday 19 April 2006 19:21, Volkan YAZICI wrote: > Here's simple query, to list which table's which columns references to a > specific table. (Hope this is what you asked for.) > > SELECT TBL.table_name, COL.column_name > FROM information_schema.referential_constraints AS REF > INNE

Re: [SQL] Primary key reference count

2006-04-19 Thread Volkan YAZICI
On Apr 19 02:01, Wiebe Cazemier wrote: > I'm trying to find which of the tables in pg_catalog contains the amount of > references to a primary key, but I can't seem to find it. Here's simple query, to list which table's which columns references to a specific table. (Hope this is what you asked for

Re: [SQL] Primary key reference count

2006-04-19 Thread Wiebe Cazemier
On Wednesday 19 April 2006 17:00, Wiebe Cazemier wrote: > Never mind. I found another solution. Whoops. Posted to quickly there. I do still need to know the amount of references to the primary key. ---(end of broadcast)--- TIP 1: if posting/readin

Re: [SQL] Primary key reference count

2006-04-19 Thread Wiebe Cazemier
On Wednesday 19 April 2006 15:33, Wiebe Cazemier wrote: > Either I'm blind, or this is not what I'm looking for. I need to know the > amount of references _to_ a primary key. If you have a customer with two > orders and one invoice, the reference count for the primary key of the > custormer would

Re: [SQL] Primary key reference count

2006-04-19 Thread Wiebe Cazemier
On Wednesday 19 April 2006 15:09, A. Kretschmer wrote: > Yes, > http://www.postgresql.org/docs/8.1/interactive/catalog-pg-constraint.html Either I'm blind, or this is not what I'm looking for. I need to know the amount of references _to_ a primary key. If you have a customer with two orders and o

Re: [SQL] Primary key reference count

2006-04-19 Thread A. Kretschmer
am 19.04.2006, um 14:01:03 +0200 mailte Wiebe Cazemier folgendes: > Hi, > > I'm trying to find which of the tables in pg_catalog contains the amount of > references to a primary key, but I can't seem to find it. Google queries are > also less than successful. Is it even stored in the catalog? Y

[SQL] Primary key reference count

2006-04-19 Thread Wiebe Cazemier
Hi, I'm trying to find which of the tables in pg_catalog contains the amount of references to a primary key, but I can't seem to find it. Google queries are also less than successful. Is it even stored in the catalog? ---(end of broadcast)--- TIP

Re: [SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Devrim GUNDUZ
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, On Thu, 2 Sep 2004, Nosyman wrote: It is necessary to define an index for a primary key column? Let's have an example CREATE TABLE users( id_user INTEGER PRIMARY KEY, user_name VARCHAR(25) ); Does PgSQL automatically create an index for id_user (pri

Re: [SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Achilleus Mantzios
O kyrios Nosyman egrapse stis Sep 2, 2004 : > It is necessary to define an index for a primary key column? > > Let's have an example > CREATE TABLE users( > id_user INTEGER PRIMARY KEY, > user_name VARCHAR(25) > ); > > Does PgSQL automatically create an index for id_user (primary key) or it > mu

[SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Nosyman
It is necessary to define an index for a primary key column? Let's have an example CREATE TABLE users( id_user INTEGER PRIMARY KEY, user_name VARCHAR(25) ); Does PgSQL automatically create an index for id_user (primary key) or it must be created by hand? Thanks

Re: [SQL] Primary Key Help !

2002-12-12 Thread Ludwig Lim
--- Waheed Rahuman <[EMAIL PROTECTED]> wrote: > Hi Greetings > My question is How many primary key i can assign in > a PostGresql Table > > Rowid| Parent1 | Parent2 > | Parent3 | Parent4 | > Parent5 | Parent6 | Parent7

[SQL] Primary Key Help !

2002-12-11 Thread Waheed Rahuman
Hi Greetings Friends please help me in setting the primary key in a table how many primary key i can create. In MS access its only 10 column can be made into primary key !. My question is How many primary key i can assign in a PostGresql Table   Rowid    |  Parent1   |  Par

Re: [SQL] Primary key with oid + name : error, which solution ?

2001-10-31 Thread Stephan Szabo
On Wed, 31 Oct 2001, [ISO-8859-1] Stéphane Chomat wrote: > Yes, name is an internal type. The problem is in the type of the table > repertory. If it is not > possible to use this syntaxe, i will take the type char. I just try the > new possibility of postgressql. Yeah. I think the problem is th

Re: [SQL] Primary key with oid + name : error, which solution ?

2001-10-31 Thread Stéphane Chomat
Yes, name is an internal type. The problem is in the type of the table repertory. If it is not possible to use this syntaxe, i will take the type char. I just try the new possibility of postgressql. thanks. steph. Le mercredi 31 octobre 2001, à 11:08 , Stephan Szabo a écrit : On Wed, 31 Oct 2001

Re: [SQL] Primary key with oid + name : error, which solution ?

2001-10-31 Thread Stephan Szabo
On Wed, 31 Oct 2001, [ISO-8859-1] Stéphane Chomat wrote: > I create two table repertory and person. And i have an error : > > > CREATE TABLE repertory (name_rep name, attribut text[], PRIMARY > KEY(name_rep)); > > CREATE TABLE person (nam_rep repertory, name_pers text, url text, eadr > text, te

Re: [SQL] Primary key with oid + name : error, which solution ?

2001-10-31 Thread Roberto Mello
On Wed, Oct 31, 2001 at 10:06:22AM +0100, St?phane Chomat wrote: > I create two table repertory and person. And i have an error : > > > CREATE TABLE repertory (name_rep name, attribut text[], PRIMARY > KEY(name_rep)); > > CREATE TABLE person (nam_rep repertory, name_pers text, url text, > e

[SQL] Primary key with oid + name : error, which solution ?

2001-10-31 Thread Stéphane Chomat
I create two table repertory and person. And i have an error : > CREATE TABLE repertory (name_rep name, attribut text[], PRIMARY KEY(name_rep)); > CREATE TABLE person (nam_rep repertory, name_pers text, url text, eadr text, tel text, attribut text[], PRIMARY KEY(name_pers,nam_rep)); NOTICE: CRE

RE: [SQL] primary key scans in sequence

2001-05-31 Thread Gerald Gutierrez
I think you're just witnessing the optimizer at work. If it thinks that doing sequential scans is faster, it will ignore the indices. At 11:03 AM 5/31/2001 +0200, Koen Antonissen wrote: >Thing I descovered after i posted to the group was that after creating >the scheme again, the indexes are us

RE: [SQL] primary key scans in sequence

2001-05-31 Thread Stephan Szabo
It really depends on the number of rows. If the number of rows in the tables are small or the number of rows returned is a reasonable percentage, the index scan is currently more expensive. What does (for example) select count(*) from classes; give? On Thu, 31 May 2001, Koen Antonissen wrote:

RE: [SQL] primary key scans in sequence

2001-05-31 Thread Koen Antonissen
nalyze) the use of indexes was gone again on certain tables... Any other suggestions? -Original Message- From: bernd pinter [mailto:[EMAIL PROTECTED]] Sent: donderdag 31 mei 2001 8:53 To: Koen Antonissen Subject: Re: [SQL] primary key scans in sequence the problem is the optimizer. you u

RE: [SQL] primary key scans in sequence

2001-05-30 Thread Stephan Szabo
On Wed, 30 May 2001, Koen Antonissen wrote: > Now this one doesn't: > Table "teams" > Attribute | Type | Modifier > ---+-+-- > id| integer | not null

RE: [SQL] primary key scans in sequence

2001-05-30 Thread Koen Antonissen
Scan on teams (cost=0.00..1.09 rows=1 width=173) EXPLAIN I really don't understand the difference between the two, and it didn't work before i created an extra index on id... Kind regards, Koen Antonissen -Original Message----- From: Richard Poole [mailto:[EMAIL PROTECTED]]

Re: [SQL] primary key scans in sequence

2001-03-30 Thread Peter Eisentraut
bernd writes: > hey i have the following table def (834.000 rows, vaccum analyze'd): > dl_online=# \d mitglied > Table "mitglied" >Attribute| Type | Modifier > +--+ > mitgliedid | bigint

Re: [SQL] primary key scans in sequence

2001-03-30 Thread Richard Poole
On Thu, Mar 29, 2001 at 03:47:58PM +0200, bernd wrote: > hey i have the following table def (834.000 rows, vaccum analyze'd): > dl_online=# \d mitglied > Table "mitglied" >Attribute| Type | Modifier > +--+--

[SQL] primary key scans in sequence

2001-03-30 Thread bernd
hey i have the following table def (834.000 rows, vaccum analyze'd): dl_online=# \d mitglied Table "mitglied" Attribute| Type | Modifier +--+ mitgliedid | bigint | not null dlnummer

Re: [SQL] primary key and indexing

2001-01-19 Thread Richard Huxton
Sorry for lack of proper quoting, you might find it useful to From: "Sharmad Naik" <[EMAIL PROTECTED]> I m sorry If anyone has already asked this Q earlier I wanted to know Q1. Whether I can have another key on which the table is indexed even though i have a primary key..Then how would the

[SQL] primary key and indexing

2001-01-19 Thread Sharmad Naik
I m sorry If anyone has already asked this Q earlier     I wanted to know   Q1. Whether I can have another key on which the table is indexed even though i have a primary key..Then how would the data be accessed according to primary key or the indexed key of my choice or i can index as per m

RE: [SQL] primary key question

2000-07-25 Thread Pablo Niklas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 El 20-Jul-2000 Carolyn Lu Wong escribio: > create table aaa( > field1 not null, > field2 , > , > primary key (field1, field2) > ); > > Based on the above table definition, field2 allows null values. But > after

Re: [SQL] primary key question

2000-07-20 Thread omid omoomi
>From: Carolyn Lu Wong <[EMAIL PROTECTED]> >To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >Subject: [SQL] primary key question >Date: Thu, 20 Jul 2000 17:26:30 +1000 > >create table aaa( > field1 not null, > field2 , >

Re: [SQL] primary key question

2000-07-20 Thread Wim Ceulemans
Carolyn Lu Wong wrote: > > create table aaa( > field1 not null, > field2 , > , > primary key (field1, field2) > ); > > Based on the above table definition, field2 allows null values. But > after the table created based on the above script, field2 be

[SQL] primary key question

2000-07-20 Thread Carolyn Lu Wong
create table aaa( field1 not null, field2 , , primary key (field1, field2) ); Based on the above table definition, field2 allows null values. But after the table created based on the above script, field2 becomes not null. The only conclusion I come u