Re: [ADMIN] Primary key on existing table?

2009-08-26 Thread Carol Walter
Thanks, guys. Worked like a charm. Carol On Aug 25, 2009, at 6:25 PM, Scott Marlowe wrote: On Tue, Aug 25, 2009 at 2:25 PM, Carol Walter wrote: This may be a silly question but I don't see any place where the documentation explicitly addresses whether or not you can designate a particular co

Re: [ADMIN] Primary key on existing table?

2009-08-25 Thread Patrick
Carol Walter wrote: This may be a silly question but I don't see any place where the documentation explicitly addresses whether or not you can designate a particular column as a primary key after the table is created. I used the "create table as " syntax to create a table with the same columns

Re: [ADMIN] Primary key on existing table?

2009-08-25 Thread Scott Marlowe
On Tue, Aug 25, 2009 at 2:25 PM, Carol Walter wrote: > This may be a silly question but I don't see any place where the > documentation explicitly addresses whether or not you can designate a > particular column as a primary key after the table is created.  I used the > "create table as " syntax to

Re: [ADMIN] Primary key on existing table?

2009-08-25 Thread Ries van Twisk
On Aug 25, 2009, at 3:25 PM, Carol Walter wrote: This may be a silly question but I don't see any place where the documentation explicitly addresses whether or not you can designate a particular column as a primary key after the table is created. I used the "create table as " syntax to cr

Re: [ADMIN] Primary key on existing table?

2009-08-25 Thread Kevin Grittner
Carol Walter wrote: > This may be a silly question but I don't see any place where the > documentation explicitly addresses whether or not you can designate > a particular column as a primary key after the table is created. It sounds like you need ALTER TABLE DROP CONSTRAINT and ALTER TABLE

[ADMIN] Primary key on existing table?

2009-08-25 Thread Carol Walter
This may be a silly question but I don't see any place where the documentation explicitly addresses whether or not you can designate a particular column as a primary key after the table is created. I used the "create table as " syntax to create a table with the same columns as an original

Re: [ADMIN] primary key and insert

2008-12-11 Thread Suresh Borse
Create a sequence and use the sequence in your insert statement. On Thu, 2008-12-11 at 15:27 -0800, Marc Fromm wrote: > I created this table: >Column | Type | Modifiers > ++ >first_name | charact

Re: [ADMIN] primary key and insert

2008-12-11 Thread johnf
On Thursday 11 December 2008 03:27:59 pm Marc Fromm wrote: >  id         | integer                       | not null I believe you did not set the field 'id' to a data type of serial. If you had you would have "nextval(" in the Modifiers column. -- John Fabiani -- Sent via pgsql-admin mailing

Re: [ADMIN] primary key and insert

2008-12-11 Thread Steve Crawford
Marc Fromm wrote: I created this table: ... id | integer | not null Indexes: "alert_list_pkey" PRIMARY KEY, btree (id) I get this error when I run the insert a listed below. The insert does not have an entry for the primary key "id" since I thought it upd

[ADMIN] primary key and insert

2008-12-11 Thread Marc Fromm
I created this table: Column | Type | Modifiers ++ first_name | character varying(20) | last_name | character varying(30) | w_number | character varying(9)| alert | character va

Re: [ADMIN] Primary key

2007-09-19 Thread Igor Neyman
Yes, PG allows compound or composite keys for primary keys. Igor -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carol Walter Sent: Wednesday, September 19, 2007 10:37 AM To: pgsql-admin@postgresql.org Subject: [ADMIN] Primary key Hello, Does postgres

Re: [ADMIN] Primary key

2007-09-19 Thread Niklas Johansson
On 19 sep 2007, at 16.37, Carol Walter wrote: Does postgres allow compound or composite keys for primary keys? I thought I read someplace that it didn't. Now, I can't find a reference to it. Yes, it does. http://www.postgresql.org/docs/8.2/interactive/ddl- constraints.html#AEN2080 Si

Re: [ADMIN] Primary key

2007-09-19 Thread Richard Broersma Jr
--- Carol Walter <[EMAIL PROTECTED]> wrote: > Does postgres allow compound or composite keys for primary keys? I > thought I read someplace that it didn't. Now, I can't find a > reference to it. It does. composite key are defined as a table constraint: http://www.postgresql.org/docs/8.2/in

[ADMIN] Primary key

2007-09-19 Thread Carol Walter
Hello, Does postgres allow compound or composite keys for primary keys? I thought I read someplace that it didn't. Now, I can't find a reference to it. Carol ---(end of broadcast)--- TIP 5: don't forget to increase your free space map setti

Re: [ADMIN] primary key and foreign key

2007-07-25 Thread Richard Broersma Jr
--- Jessica Richard <[EMAIL PROTECTED]> wrote: > Just want to be very clear that: > > 1. adding a primary key will have an implicit index automatically on the > column(s). > > 2. Adding a foreign key will NOT have an index created automatically, it only > does the > referencing work. If an in

[ADMIN] primary key and foreign key

2007-07-25 Thread Jessica Richard
Just want to be very clear that: 1. adding a primary key will have an implicit index automatically on the column(s). 2. Adding a foreign key will NOT have an index created automatically, it only does the referencing work. If an index is needed on the F-key column, it has to be created, right?

[ADMIN] primary key constraint violation

2005-08-07 Thread Politowicz, Phil
I am running a 7.4.3 postgreSQL database on RHEL 3. I have encountered two cases where tables have multiple key values, in violation of a primary key constraint. I discovered this after receiving SQL exceptions, where the primary key constraint was all of a sudden being enforced again. This may be

[ADMIN] primary key and the default index operator class

2004-11-23 Thread Sally Sally
I am trying to figure out how I can change the default operator class of the index created for my primary key field. Is it even possible since I am not able to find the syntax? Or do I need to create the primary key and then an additional index with the operator class I want. (It would be a wast

Re: [ADMIN] PRIMARY KEY Indexes.

2002-01-28 Thread Stephan Szabo
On Mon, 28 Jan 2002, Marc Mitchell wrote: > pgsqlPostgres automatically creates a unique index to assure data integrity > (see CREATE INDEX statement). > > The online docs at > http://www.postgresql.org/idocs/index.php?sql-createtable.html state the > following: > > " Postgres automatically creat

[ADMIN] PRIMARY KEY Indexes.

2002-01-28 Thread Marc Mitchell
pgsqlPostgres automatically creates a unique index to assure data integrity (see CREATE INDEX statement). The online docs at http://www.postgresql.org/idocs/index.php?sql-createtable.html state the following: " Postgres automatically creates a unique index to assure data integrity (see CREATE IN

Re: [ADMIN] Primary Key Problems

2002-01-14 Thread Phill Kenoyer
I did have this problem in the past. I have a table with three fields set for the primary key. Somehow I would get dups in that table. I'm not sure how as I am too busy to test it. I changed my insert queries to check for existing data before the insert so I could get back to work. Someone di

Re: [ADMIN] Primary Key Problems

2002-01-14 Thread steve boyle
Tony / Phil, my 2c on the Primary Key definition / usage. If you have any SQL / DDL code that disagrees with the definitions below could you please repost them. "Tony Reina" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > [EMAIL PROTECTED] (Phill Kenoyer) wro

Re: [ADMIN] Primary Key Problems

2001-12-28 Thread Tony Reina
[EMAIL PROTECTED] (Phill Kenoyer) wrote in message news:<[EMAIL PROTECTED]>... > Here is a good one. I have three fields set for my primary key. Now I > thought that a primary key was unique, and dups can not be inserted. > I don't think primary keys per se are unique, but rather can be made

Re: [ADMIN] Primary Key Problems

2001-12-18 Thread Tom Lane
Phill and Glen, We've just tracked down one mechanism that allows duplicate rows to be spawned --- see http://fts.postgresql.org/db/mw/msg.html?mid=1078374 and following discussion. In the example given by Brian Hirt, VACUUM's creation of a duplicate row causes a unique-key violation to be repor

Re: [ADMIN] Primary Key Problems

2001-12-10 Thread Stephan Szabo
On Fri, 7 Dec 2001, Phill Kenoyer wrote: > I took your advice and checked the string size using char_length() and > octet_length(). They are the same. > > octet_length | stock| octet_length | inventory_type | client_id > 5 | 10725 |4 | used |

Re: [ADMIN] Primary Key Problems

2001-12-07 Thread Phill Kenoyer
I took your advice and checked the string size using char_length() and octet_length(). They are the same. octet_length | stock| octet_length | inventory_type | client_id 5 | 10725 |4 | used |60 5 | 10725 |4 | use

Re: [ADMIN] Primary Key Problems

2001-12-07 Thread Ian Barwick
On Saturday 08 December 2001 02:44, Phill Kenoyer wrote: > Here is a good one. I have three fields set for my primary key. Now I > thought that a primary key was unique, and dups can not be inserted. That's the theory ;-) > CREATE TABLE "inventory" ( > "stock" character varying(50) NOT

[ADMIN] Primary Key Problems

2001-12-07 Thread Phill Kenoyer
Here is a good one. I have three fields set for my primary key. Now I thought that a primary key was unique, and dups can not be inserted. CREATE TABLE "inventory" ( "stock" character varying(50) NOT NULL, "inventory_type" character varying(20) DEFAULT 'unknown' NOT NULL,

Re: [ADMIN] primary key problem

2001-09-10 Thread Stephan Szabo
On Mon, 10 Sep 2001, Mohammad Faisal wrote: > the primary key in postgreSQL is implemented as unique > index and the unique index can be deleted and as a > result the primary key constraints finishes.(oh a > problem) > what if i don't want an index on a table then in this > case how can i impleme

[ADMIN] primary key problem

2001-09-10 Thread Mohammad Faisal
hey all, the primary key in postgreSQL is implemented as unique index and the unique index can be deleted and as a result the primary key constraints finishes.(oh a problem) what if i don't want an index on a table then in this case how can i implement Primary key constraint. any help t