; <[EMAIL PROTECTED]>
Cc:
Sent: Friday, February 08, 2008 2:17 PM
Subject: Re: [SQL] Serial not nulla
Shavonne Marietta Wijesinghe wrote:
Hello
I am working with a database that has a Index number defined as Serial
NOT NULL
I used this because,
1. I want to make sure that when many users log
Shavonne Marietta Wijesinghe wrote:
Hello
I am working with a database that has a Index number defined as Serial NOT NULL
I used this because,
1. I want to make sure that when many users login at the same time the Index
number won't be repeated.
2. I don't have to increment it by programming (
Hello
I am working with a database that has a Index number defined as Serial NOT NULL
I used this because,
1. I want to make sure that when many users login at the same time the Index
number won't be repeated.
2. I don't have to increment it by programming (I use ASP)
But now i have a situation
Aleksandr Vinokurov wrote:
Logging will be done with this rule:
create or replace rule chuwee_rule as on insert to chuwee
do insert into chuwee_log (num, mesg)
values (new.num, new.mesg);
Don't do logging with rules, do logging with triggers.
See mailing-list archives for details.
--
R
Hello all,
I have a question with the SERIAL type. I want to use it for default
identification of table entries:
create table chuwee (
num serial primary key,
mesg varchar(50) not null
);
And all the inserts to this table I'm gonna log to this table:
create table chuwee_log (
id seri
On Tue, May 15, 2007 at 07:40:25AM -0400, [EMAIL PROTECTED] wrote:
> Suppose if i will fire a query "select Name from tablename where age=30".
> it will give output "shyam" but i also want record no. other then oid, in
> this case it is 3.
>
> is it possible?
> if yes then how?
> plz. help me.
Th
Hi List,
I have one table something like this
Name Age
=
tom 20
ram 25
shyam 30
balram15
hari 10
Now i want serial number of a record.
Suppose if i will fire a query "select Name from tablename where age=30".
it will give outp
--- > Yes there is, and you generally shouldn't do it. There are issues with
> race conditions and misreferenced data that can happen when you try to
> reuse sequence numbers.
>
> Sadly, some poorly defined business processes require this.
>
> Are you required to have sequential numbers, or is
On Tue, 2007-04-03 at 04:20, Shavonne Marietta Wijesinghe wrote:
> Ok so i'm posting alot in the forums. Anyway for a change i have
> another problem ^___^
>
> I have a table that has a field n_gen serial NOT NULL
>
> ermm let me explain. I have 5 records inserted (n_gen = 1, 2, 3, 4, 5)
>
>
am Tue, dem 03.04.2007, um 12:29:37 +0200 mailte Shavonne Marietta Wijesinghe
folgendes:
> I'm mixed up now. I was suppose to something but i did something else.
>
> OK so i have my FAMOUS table with the n_gen serial NOT NULL
> I got lost a bit. When and where do i use the setval() ??
Only to m
I'm mixed up now. I was suppose to something but i did something else.
OK so i have my FAMOUS table with the n_gen serial NOT NULL
I got lost a bit. When and where do i use the setval() ??
For example i INSERT records via ASP. so i should put the setval() in the
INSERT INTO of the ASP page??
A
am Tue, dem 03.04.2007, um 11:55:10 +0200 mailte Shavonne Marietta Wijesinghe
folgendes:
> thanks. I read the page you gave.
Really?
>
> CREATE SEQUENCE seq_mytable_n_gen;
>
> CREATE TABLE mytable
> (
> n_gen int nextval('seq_mytable_n_gen'),
> mycolumn1 int,
> mycolumn2 int
> );
>
>
>
Shavonne Marietta Wijesinghe wrote:
> thanks. I read the page you gave.
>
> CREATE SEQUENCE seq_mytable_n_gen;
>
> CREATE TABLE mytable
> (
> n_gen int nextval('seq_mytable_n_gen'),
> mycolumn1 int,
> mycolumn2 int
> );
>
>
> i tried creating it like that. The sequence was created without an
R: syntax error at or near "nextval" at character 38
What should i do?
Shavonne Wijesinghe
- Original Message -
From: "A. Kretschmer" <[EMAIL PROTECTED]>
To:
Sent: Tuesday, April 03, 2007 11:32 AM
Subject: Re: [SQL] Serial
am Tue, dem 03.04.2007, um 11:
am Tue, dem 03.04.2007, um 11:20:16 +0200 mailte Shavonne Marietta Wijesinghe
folgendes:
> The problem is when i INSERT a new record. It takes the value n_gen = 6 but i
> need it to take the value 5. It keeps a record of the delete records.
>
> Is there anyway in PostgreSQL i can change it? or
Ok so i'm posting alot in the forums. Anyway for a change i have another
problem ^___^
I have a table that has a field n_gen serial NOT NULL
ermm let me explain. I have 5 records inserted (n_gen = 1, 2, 3, 4, 5)
At a surtain point i DELETE the record 2 and UPDATE the record 5 with the n_gen
2
In article <[EMAIL PROTECTED]>,
"alessandra de gregorio" <[EMAIL PROTECTED]> writes:
> Hi,
> What function should I use to get a serial number, together with my results,
> from a query?
> Ex. Of output I want:
> 1 ooo pp ij
> 2 hou joo iu
> 3 bhi ft yh
alessandra de gregorio <[EMAIL PROTECTED]> schrieb:
> Hi,
>
> What function should I use to get a serial number, together with my results,
> from a query?
>
> Ex. Of output I want:
>
> 1 ooo pp ij
> 2 hou joo iu
> 3 bhi ft yh
>
> Basically, I would l
Hi,
What function should I use to get a serial number, together with my results,
from a query?
Ex. Of output I want:
1 ooo pp ij
2 hou joo iu
3 bhi ft yh
Basically, I would like to have one column with integers, from 1 onwards, no
matter how man
"Sam Adams" <[EMAIL PROTECTED]> writes:
> I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1
> that when a serial is created then an index is created on the column.
> However I can't seem to find this anywhere in the PoistgreSQL manual. Is
> this true? Thanks.
It was once true
On Sun, 2005-02-27 at 12:54 +, Sam Adams wrote:
> I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1
> that when a serial is created then an index is created on the column.
> However I can't seem to find this anywhere in the PoistgreSQL manual. Is
> this true? Thanks.
no,
Documentation at
http://www.postgresql.org/docs/8.0/interactive/datatype.html#DATATYPE-SERIAL
says:
"In most cases you would also want to attach a UNIQUE or PRIMARY KEY
constraint to prevent duplicate values from being inserted by accident,
but this is not automatic."
and
"*Note: * Prior to P
On Sun, 27 Feb 2005 12:54:52 +, Sam Adams <[EMAIL PROTECTED]> wrote:
> I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1
> that when a serial is created then an index is created on the column.
> However I can't seem to find this anywhere in the PoistgreSQL manual. Is
> thi
On Sun, Feb 27, 2005 at 12:54:52PM +, Sam Adams wrote:
> I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1
That copy of the FAQ is over two years old according to the "Last
updated" text at the top of the page. You can find the current FAQ
here:
http://www.postgresql.o
On Sun, Feb 27, 2005 at 12:54:52 +,
Sam Adams <[EMAIL PROTECTED]> wrote:
> I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1
> that when a serial is created then an index is created on the column.
> However I can't seem to find this anywhere in the PoistgreSQL manual. Is
I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1
that when a serial is created then an index is created on the column.
However I can't seem to find this anywhere in the PoistgreSQL manual. Is
this true? Thanks.
-Sam
---(end of broadcast)-
You can create the sequence manually and define that a the default for
the column. I suppose we could pass the create sequence params through
SERIAL but there doesn't seem like there is much demand for it.
---
Arnold Puton
Would it be possible to have parameters in the SERIAL datatype?
CREATE TABLE x { ID SERIAL(100, 10) }
means ID starts at 100 and will be incremented by 10. And it would be
nice to have
CREATE TABLE x { ID SERIAL(0,0) }
mean that ID will be issued random non-repeating values (period=2^bitwid
On Thu, 13 Jun 2002, Charlie Toohey wrote:
> If session A and session B are concurrently doing the same master-detail
> transaction, wouldn't currval possibly reflect the sequence value used by the
> other session ? Or are you saying that since this will be an explicit
> transaction that currval
that definitely helps ! thank you Jason --- the key thing that I didn't
undertand, and you have now enlightened me, is that currval was connection
dependent --- I didn't think this would be guaranteed to work with concurrent
transactions, but now I understand.
Just prior to receiving your mess
Charlie Toohey <[EMAIL PROTECTED]> writes:
> I'm having a problem and there seems to be 2 solutions. It is simple
> and straighforward, but will take several paragraphs to explain.
>
> I have a schema with a master-detail design. The master table does
> not have an expicit id, so I have a column
If session A and session B are concurrently doing the same master-detail
transaction, wouldn't currval possibly reflect the sequence value used by the
other session ? Or are you saying that since this will be an explicit
transaction that currval won't reflect the fact that the sequence may have
Charlie Toohey <[EMAIL PROTECTED]> writes:
> A better solution would seem to use a sequence explicitly, rather than a id
> column of type serial. I would obtain the id value from the sequence, and
> then insert this id into the master table and into the detail table.
Yup. But there's no need t
Charlie,
> Lets say I need to insert a row into the master table and N rows into the
> detail table. After inserting a row into master, and before detail, I need
to
> read the master table to obtain the value of the id for the row just
> inserted, so I can insert this id as the foreign key v
On Thu, 13 Jun 2002, Charlie Toohey wrote:
> I'm having a problem and there seems to be 2 solutions. It is simple and
> straighforward, but will take several paragraphs to explain.
>
> I have a schema with a master-detail design. The master table does not have
> an expicit id, so I have a column
I'm having a problem and there seems to be 2 solutions. It is simple and
straighforward, but will take several paragraphs to explain.
I have a schema with a master-detail design. The master table does not have
an expicit id, so I have a column of type serial.
Lets say I need to insert a row i
CREATE TABLE tablename (colname SERIAL);
okay, but how do I set the beginning number. So far the only thing I
have been able to do is directly after creating the serial column, I do:
select setval('tablename_colname_seq', 15753);
Is this the only way to set the beginning number of a sequence?
n
passing it back to my app. commit, then do an update. I can not
seem to get the seq to work.
Ted
-Original Message-
From: Michael Fork <[EMAIL PROTECTED]>
To: postgresql <[EMAIL PROTECTED]>
Date: Thu, 29 Mar 2001 10:04:46 -0500 (EST)
Subject: Re: [SQL] serial type; race co
Thus spake postgresql
> How does currval work if you are not inside a transaction. I have
> been experimenting with inserting into a table that has a sequence.
> If the insert fails (not using a transaction) because of bad client input
> then the next insert gets the proper next number in the s
want
> the empty row.
>
> Thanks, it is getting clearer
>
> Ted
>
>
> -Original Message-
> From: Bruce Momjian <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Date: Mon, 26 Mar 2001 16:47:37 -0500 (EST)
> Subject: Re: [SQL] serial type; race
I ditto what Bruce said - trying to get a true sequence without gaps is a
losing battle. Why don't you, instead, use a serial column as the real
sequence, and then a trigger that simply inserts max(foo) + 1 in a
different column? Then when you need to know the column, do something
like:
SELECT nu
> How does currval work if you are not inside a transaction. I have
> been experimenting with inserting into a table that has a sequence.
> If the insert fails (not using a transaction) because of bad client input
> then the next insert gets the proper next number in the sequence.
If you are i
hanks, it is getting clearer
Ted
-Original Message-
From: Bruce Momjian <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Mon, 26 Mar 2001 16:47:37 -0500 (EST)
Subject: Re: [SQL] serial type; race conditions
> > Hi,
> >
> > I'm using serial fields to gen
> Hi,
>
> I'm using serial fields to generate IDs for almost all object in my
> database. I insert an empty row, get the CURRVAL() of the sequence
> and then update to that value.
>
> I had understood (and now, I can't find the reference to back this up)
> that serial is implemented in such a w
Hi,
I'm using serial fields to generate IDs for almost all object in my
database. I insert an empty row, get the CURRVAL() of the sequence
and then update to that value.
I had understood (and now, I can't find the reference to back this up)
that serial is implemented in such a way that race con
postgresql wrote:
>
> I have a table that I want to add a serial type column. Is there a way
> to add it or do I have to create a new table and insert into it. I have
> experimented with:
>
> insert into newdb (name) select name from olddb order by jobno;
>
> however, pg does not allow the 'ord
On Mon, 19 Mar 2001, postgresql wrote:
> I have a table that I want to add a serial type column. Is there a way
> to add it or do I have to create a new table and insert into it. I have
> experimented with:
>
> insert into newdb (name) select name from olddb order by jobno;
>
> however, pg d
I have a table that I want to add a serial type column. Is there a way
to add it or do I have to create a new table and insert into it. I have
experimented with:
insert into newdb (name) select name from olddb order by jobno;
however, pg does not allow the 'order by' during an insert/select
I
On Sat, 10 Jun 2000, Jean-Marc Libs wrote:
Hi all,
> I don't really understand what happens, so I put context, then problem:
>
> 1/ Context
> --
> I have this table:
>
> CREATE TABLE film (
> film_id SERIAL PRIMARY KEY,
snip
> )
> ;
> SELECT setval ('film_film_id_seq', 6);
>
> 2/ Prob
Jean-Marc Libs wrote:
>
> I have this table:
>
> CREATE TABLE film (
>film_id serial,
> ...
>
> SELECT setval ('film_film_id_seq', 6);
>
> I have this query in PHP:
> insert into film
>
>(film_country_id,film_country_id2,film_country_id3,film_country_id4,film_prod_year,film_ec_certif,film_
Hi all,
I don't really understand what happens, so I put context, then problem:
1/ Context
--
I have this table:
CREATE TABLE film (
film_id SERIAL PRIMARY KEY,
film_country_id CHAR(2),
film_country_id2 CHAR(2),
film_country_id3 CHAR(2),
film_country_id4 CHAR(2),
film_ec_certif BOOL DEF
51 matches
Mail list logo