On 10/11/2012 05:11 PM, Vineet Deodhar wrote:
On Thu, Oct 11, 2012 at 12:56 PM, Scott Marlowe mailto:scott.marl...@gmail.com>> wrote:
Can't you just add this to your create table:
CREATE TABLE tablename (
colname SERIAL
, check (colname>0 and colname < 32768));
);
W
On Thu, Oct 11, 2012 at 5:11 PM, Vineet Deodhar wrote:
> On Thu, Oct 11, 2012 at 12:56 PM, Scott Marlowe
> wrote:
>
>>
>> Can't you just add this to your create table:
>>
>>
>> CREATE TABLE tablename (
>>colname SERIAL
>> , check (colname>0 and colname < 32768));
>> );
>>
>>
>>
> With this co
On Thu, Oct 11, 2012 at 12:56 PM, Scott Marlowe wrote:
>
> Can't you just add this to your create table:
>
>
> CREATE TABLE tablename (
>colname SERIAL
> , check (colname>0 and colname < 32768));
> );
>
>
>
With this constraint, whether the storage space requirement would reduce?
OR
Is it just
On 10/11/2012 03:04 PM, Vineet Deodhar wrote:
user_id smallint NOT NULL DEFAULT nextval('user_id_seq')
I'm kind of puzzled about why you'd want to use a serial on a field that
can contain at most 65,536 entries anyway. If you're only going to have
a max of 65,536 entries then the spa
On Thu, Oct 11, 2012 at 1:04 AM, Vineet Deodhar
wrote:
> I wish to know regarding auto-increment field.
> I learn that the required table definition would be something like --
>
> CREATE TABLE tablename (
> colname SERIAL
> );
>
> For more granular control over the size of field, I need to do
I wish to know regarding auto-increment field.
I learn that the required table definition would be something like --
CREATE TABLE tablename (
colname SERIAL
);
For more granular control over the size of field, I need to do the following---
CREATE SEQUENCE user_id_seq;
CREATE TABLE user (
On 10/04/2011 08:05 AM, Robert Buckley wrote:
> Thanks for the replies,
>
> I have one question regarding this comment...
>
> "You also need to add a DEFAULT expression and optionally
> make the sequence owned by the column:"
>
> What difference does it make if a table "owns" a sequence of not?.
Hi,
2011-10-04 14:05 keltezéssel, Robert Buckley írta:
> Thanks for the replies,
>
> I have one question regarding this comment...
>
> "You also need to add a DEFAULT expression and optionally
> make the sequence owned by the column:"
>
> What difference does it make if a table "owns" a sequence o
neral@postgresql.org
Gesendet: 13:43 Dienstag, 4.Oktober 2011
Betreff: Re: [GENERAL] auto-increment column
2011-10-04 13:30 keltezéssel, Robert Buckley írta:
Hi,
>
>
>I have a column in a table called hist_id with the datatype "integer". When I
>created the table I assigned
2011-10-04 13:30 keltezéssel, Robert Buckley írta:
> Hi,
>
> I have a column in a table called hist_id with the datatype "integer". When I
> created
> the table I assigned this column the primary key constraint but didn´t make
> it an
> auto-increment column.
>
> How could I do this to an the alr
On Tue, Oct 04, 2011 at 12:30:48PM +0100, Robert Buckley wrote:
> Hi,
>
> I have a column in a table called hist_id with the datatype "integer". When I
> created the table I assigned this column the primary key constraint but
> didn´t make it an auto-increment column.
>
> How could I do this to
Hi,
I have a column in a table called hist_id with the datatype "integer". When I
created the table I assigned this column the primary key constraint but didn´t
make it an auto-increment column.
How could I do this to an the already existing column?
I have created the sequence with the followi
and why you are doing that so alternative solutions can
be presented.
David J
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Adarsh Sharma
Sent: Friday, February 11, 2011 6:14 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Auto-Increment
On 02/11/2011 12:13 PM, Adarsh Sharma wrote:
Dear all,
I have an Integer column in Postgres database table. Let's say the
column has below values :
1
2
3
4
5
6
7
8
9
10
Now if i deleted some rows where id= 3 ,5 and 8 or it have these type
of data then
The data look like as :
1
2
4
6
On 11 February 2011 11:13, Adarsh Sharma wrote:
> Dear all,
>
>
> I have an Integer column in Postgres database table. Let's say the column
> has below values :
>
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
>
>
> Now if i deleted some rows where id= 3 ,5 and 8 or it have these type of
> data then
Dear all,
I have an Integer column in Postgres database table. Let's say the
column has below values :
1
2
3
4
5
6
7
8
9
10
Now if i deleted some rows where id= 3 ,5 and 8 or it have these type
of data then
The data look like as :
1
2
4
6
7
9
10
I want to have it id's as
1
2
3
4
5
6
> Just a wild notion, but would the generate_series function be any use to
> you?
Good idea, but i can't get it to work.
create or replace view testview3 as (
select generate_series(1,(select count(*) from test group by "value")), value
from test group by value);
select * from testview3 limit 5;
Willy-Bas Loos wrote:
Hi,
I'm trying to figure out to generate a auto-increment column in a view.
There is no physical column to base it on, the view contains a group
by clause, which renders that impossible.
In a normal query i can create a sequence for that purpouse and drop
it afterwards, but
On 03/09/2009 17:22, Willy-Bas Loos wrote:
> Hi,
>
> I'm trying to figure out to generate a auto-increment column in a view.
> There is no physical column to base it on, the view contains a group
> by clause, which renders that impossible.
> In a normal query i can create a sequence for that purpo
Hi,
I'm trying to figure out to generate a auto-increment column in a view.
There is no physical column to base it on, the view contains a group
by clause, which renders that impossible.
In a normal query i can create a sequence for that purpouse and drop
it afterwards, but apart form it being ugl
On Tue, Jan 17, 2006 at 04:33:46PM +0100, Bogdoll, Dieter wrote:
> Is there any way to achieve the same result in Postgresql as the MySQL
> AUTO_INCREMENT does?
Not without an adverse impact on performance. PostgreSQL's serial
type is just a notational convenience for an integer column that
takes
Title: auto increment within a compound key
Hi,
I want to create a compound primary key. The elements of this primary key should be
the fields called nb (int) and d (double). nb should be default and autoincremented,
so that the following four inserts
insert into mytable (ts) values ( 1
You'll probably need a sequence per thread. A sequence is not
necessarily tied to a column.
-tfo
On Sep 12, 2004, at 11:16 AM, Nick wrote:
This is actually a table that holds message threads for message
boards. Column A is really 'message_board_id' and column B is
'thread_id'. I would like every
On Sun, Sep 12, 2004 at 09:16:37 -0700,
Nick <[EMAIL PROTECTED]> wrote:
> This is actually a table that holds message threads for message
> boards. Column A is really 'message_board_id' and column B is
> 'thread_id'. I would like every new thread for a message board to have
> a 'thread_id' of 1 a
How does this imply one sequence? Is it guaranteed that for each value
of a, the values of b will be equivalent to all (and only) values of a?
There's plenty of flexibility within postgres for ways to use sequences.
Regardless, I think you need to have (and present) a better idea of
what you're
Is it possible to have a sequence across two columns. For example
table1
+---+---+
| a | b |
+---+---+
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 2 |
| 2 | 3 |
| 3 | 1 |
| 3 | 2 |
| 3 | 3 |
+---+---+
Would I have to create a new sequence for every unique 'a' column?
That seems pretty tedious.
Hello all,
Any ideas how I can duplicate the auto increment feature that MySQL uses in
PostgreSQL? (Other than doing a query to find the next number in que)
Just thought I'd ask.
Thanks,
Kevin
_
Get your FREE download of MSN Expl
Tom Lane writes:
> At one time Marc was arranging for the list bot to append automatic
> tags to all postings. I'd be in favor of an automatic tag that read
> something like
>
> list administrivia: [EMAIL PROTECTED]
> Postgres FAQs: http://...
>
> Suggestions anyone?
On Wed, 27 Dec 2000, Tom Lane wrote:
> At one time Marc was arranging for the list bot to append automatic
> tags to all postings. I'd be in favor of an automatic tag that read
> something like
>
> list administrivia: [EMAIL PROTECTED]
> Postgres FAQs: http://...
>
>
>> Would posting a FAQ list on a regular basis to the list be
>> helpful for things like this, like is done on the Perl newsgroups?]
> I don't think so. Doesn't everyone know the location of the FAQ?
Undoubtedly not :-( ... but it's unlikely that a routine posting would
help to dispel cluelessn
> On Tue, 26 Dec 2000, Bruce Momjian wrote:
>
> > > See the documentation on CREATE SEQUENCE, and also on CREATE TABLE and the
> > > SERIAL type.
> > >
> > > [An aside: this is something definitely that qualifies as a frequently
> > > asked question, as this is like the 4th time in a week this q
On Tue, 26 Dec 2000, Bruce Momjian wrote:
> > See the documentation on CREATE SEQUENCE, and also on CREATE TABLE and the
> > SERIAL type.
> >
> > [An aside: this is something definitely that qualifies as a frequently
> > asked question, as this is like the 4th time in a week this question has
>
> On Tue, 26 Dec 2000 [EMAIL PROTECTED] wrote:
>
> > Is there a way set a primary key to Auto Increment like you can
> > with MySQL?
>
> See the documentation on CREATE SEQUENCE, and also on CREATE TABLE and the
> SERIAL type.
>
> [An aside: this is something definitely that qualifies as a
On Jue 09 Nov 2000 07:56, Marcos wrote:
> hi,
>
> i am creating a table and i want to add an auto incrementable field
>
> is that correct?
>
> psql ival << EOF
> create table partes (
> codigo int not null auto_increment,
WRONG. That is not ANSI-SQL. That is MySQL.
Define it as SERIAL, ju
Marcos wrote:
>hi,
>
>i am creating a table and i want to add an auto incrementable field
>
>is that correct?
>
>psql ival << EOF
>create table partes (
>codigo int not null auto_increment,
^^
should be SERIAL
--
Oliver Elphick
hi,
i am creating a table and i want to add an auto incrementable field
is that correct?
psql ival << EOF
create table partes (
codigo int not null auto_increment,
usuario varchar(15),
fecha date,
proyecto varchar(30),
horas int4,
trabajo varchar(100),
observaciones varchar(90),
primary
The following message is a courtesy copy of an article
that has been posted to comp.lang.java.databases as well.
I have a Java database toolkit which I'm trying to make as portable as
possible. It has to work with databases with minimal features as well
as with databases with more features.
The
On Sun, 18 Jun 2000, Vipin Samtani wrote:
> How can I auto-increment numeric primary keys? So on a table called
> "Test1" with fields "ID" and "Name" when I do an INSERT, I only type
>
> INSERT INTO Test1 values ('Bob');
>
> instead of
>
> INSERT INTO Test1 values (1, 'Bob');
>
> Is this impl
Vipin Samtani wrote:
>
> How can I auto-increment numeric primary keys? So on a table called
> "Test1" with fields "ID" and "Name" when I do an INSERT, I only type
>
> INSERT INTO Test1 values ('Bob');
>
> instead of
>
> INSERT INTO Test1 values (1, 'Bob');
>
> Is this implemented in PostgreS
How can I auto-increment numeric primary keys? So on a table called
"Test1" with fields "ID" and "Name" when I do an INSERT, I only type
INSERT INTO Test1 values ('Bob');
instead of
INSERT INTO Test1 values (1, 'Bob');
Is this implemented in PostgreSQL 7?
-Vipin
> i believe you're interested in creating a sequence. bruce momjian's book,
> in .pdf, covers this in section 7.4. the book can be found @
> www.postgresql.org/docs/awbook.html
> i've found it a great reference for those topics covered.
>
I am working hard to finish it in the next month.
--
B
i believe you're interested in creating a sequence. bruce momjian's book,
in .pdf, covers this in section 7.4. the book can be found @
www.postgresql.org/docs/awbook.html
i've found it a great reference for those topics covered.
cheers,
james
On Thu, 23 Mar 2000, [EMAIL PROTECTED] wrote:
> How
foo (ai, bar) VALUES ({nextvalresult}, 99);
- Original Message -
From: Robert Williams <[EMAIL PROTECTED]>
To: Postgres <[EMAIL PROTECTED]>
Sent: Saturday, January 23, 1999 7:28 PM
Subject: Re: [GENERAL] auto increment?
>That does the job. Thank you.
>
>Another re
he user code to
> explicitly assign its values.
>
> See CREATE_SEQUENCE in the doc.
>
> - Original Message -
> From: Robert Williams <[EMAIL PROTECTED]>
> To: Postgres <[EMAIL PROTECTED]>
> Sent: Saturday, January 23, 1999 4:11 PM
> Subject: [GENERAL]
al Message -
From: Robert Williams <[EMAIL PROTECTED]>
To: Postgres <[EMAIL PROTECTED]>
Sent: Saturday, January 23, 1999 4:11 PM
Subject: [GENERAL] auto increment?
>How do I set up a column as auto increment? I have looked
>everywhere for the postgres equivalent ROWID as in Or
How do I set up a column as auto increment? I have looked
everywhere for the postgres equivalent ROWID as in Oracle.
--
Robert Williams [EMAIL PROTECTED]
Jarob Consulting [EMAIL PROTECTED]
Provo, Utah [EMAIL PROTECTED]
begin:vcard
n:Williams;Robert
x-mozilla-html:
46 matches
Mail list logo