At 11:20 PM 11/24/2008, [EMAIL PROTECTED] wrote:
Message-Id: <[EMAIL PROTECTED]>
From: ries van Twisk <[EMAIL PROTECTED]>
To: Tk421 <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
Subject: Re: Sequence and nextval problem
Date: Mon, 24 Nov 2008 16:21:40 -0500
References: <[EMAIL PROTECTED]>
Earlier, Craig Ringer wrote:
for sample operator/cast definitions. There are some notes in the top of
the "passthrough.txt" module I attached that explain the ODBC driver
options you'll want.
Also, note that in the message I just posted the function DSN() must be
adapted to include the appro
Tk421 wrote:
Hello everybody.
I've got an vb aplication that uses an Access database. I'm trying to
convert the database to postgres. The conversion was done ok, but i've
got a little problem that i don't know how to solve. Let's see if anyone
can help me.
The conversion from acces
On Nov 24, 2008, at 2:12 PM, Tk421 wrote:
Hello everybody.
I've got an vb aplication that uses an Access database. I'm trying
to convert the database to postgres. The conversion was done ok, but
i've got a little problem that i don't know how to solve. Let's see
if anyone can help me
On Mon, Nov 24, 2008 at 12:12 PM, Tk421 <[EMAIL PROTECTED]> wrote:
> Hello everybody.
>
> I've got an vb aplication that uses an Access database. I'm trying to
> convert the database to postgres. The conversion was done ok, but i've got a
> little problem that i don't know how to solve. Let's s
> Is there a function or special system label I can use that would
generate a sequence number in the returning result set?
Would something like this work for you?
CREATE TEMP SEQUENCE foo;
SELECT a, b, c, nextval('foo') AS order FROM t1 ORDER BY a;
Mike Relyea
Product Development Engineer
Xe
"Campbell, Lance" <[EMAIL PROTECTED]> writes:
> Is there a function or special system label I can use that would
> generate a sequence number in the returning result set?
The usual hack is a temporary sequence:
regression=# create temp sequence s1;
CREATE SEQUENCE
regression=# select nextval('s1'
: Thursday, October 09, 2008 5:48 PM
Subject: Re: [SQL] sequence number in a result
Howdy, Lance.
I had that problem about a year ago, and AFAIK there is no solution, at least
not in SQL Standard.
What I did was something like
SELECT a,b,c,count(y.a) as order
FROM t1 x , t1 y
WH
Howdy, Lance.
I had that problem about a year ago, and AFAIK there is no solution, at least
not in SQL Standard.
What I did was something like
SELECT a,b,c,count(y.a) as order
FROM t1 x , t1 y
WHERE ((x.a > y.a)
OR (x.a = y.a
AND x.ID <= y.ID)) -- Use here whatever you have as primary key
On 5/7/07, Tom Lane <[EMAIL PROTECTED]> wrote:
Andrew Sullivan <[EMAIL PROTECTED]> writes:
> On Sun, May 06, 2007 at 01:45:54PM -0500, Aaron Bono wrote:
>> So my conclusion is that the function is being treated as volatile even
>> though it is stable because the number of records is small.
> I
Andrew Sullivan <[EMAIL PROTECTED]> writes:
> On Sun, May 06, 2007 at 01:45:54PM -0500, Aaron Bono wrote:
>> So my conclusion is that the function is being treated as volatile even
>> though it is stable because the number of records is small.
> I don't think that's the issue. If this is depende
On Sun, May 06, 2007 at 01:45:54PM -0500, Aaron Bono wrote:
> Then I inserted 150 more records in the slow schema and pow - it started
> working like the fast schema.
>
> So my conclusion is that the function is being treated as volatile even
> though it is stable because the number of records i
On 5/5/07, Jaime Casanova <[EMAIL PROTECTED]> wrote:
On 5/5/07, Aaron Bono <[EMAIL PROTECTED]> wrote:
> On 5/5/07, Tom Lane <[EMAIL PROTECTED]> wrote:
> > "Aaron Bono" <[EMAIL PROTECTED]> writes:
> > > 9. -> Seq Scan on branch (cost=
0.00..4.72
> rows=1
> > > width=12
On 5/5/07, Aaron Bono <[EMAIL PROTECTED]> wrote:
On 5/5/07, Tom Lane <[EMAIL PROTECTED]> wrote:
> "Aaron Bono" <[EMAIL PROTECTED]> writes:
> > 9. -> Seq Scan on branch (cost=0.00..4.72
rows=1
> > width=1281) (actual time= 130129.988..157492.057 rows=1 loops=1)
> > 10.
On 5/5/07, Tom Lane <[EMAIL PROTECTED]> wrote:
"Aaron Bono" <[EMAIL PROTECTED]> writes:
> 9. -> Seq Scan on branch (cost=0.00..4.72rows=1
> width=1281) (actual time=130129.988..157492.057 rows=1 loops=1)
> 10.Filter: ((start_day <= now(
On 5/5/07, Andrew Sullivan <[EMAIL PROTECTED]> wrote:
On Sat, May 05, 2007 at 05:00:53PM -0500, Aaron Bono wrote:
> We don't allow deletes and updates are fairly infrequent. I also did a
> vacuum analyze to no effect.
How do you "not allow" deletes?
Permissions are set on the tables to onl
On 5/5/07, Tom Lane <[EMAIL PROTECTED]> wrote:
"Aaron Bono" <[EMAIL PROTECTED]> writes:
> 9. -> Seq Scan on branch (cost=0.00..4.72rows=1
> width=1281) (actual time=130129.988..157492.057 rows=1 loops=1)
> 10.Filter: ((start_day <= now(
On Sat, May 05, 2007 at 05:00:53PM -0500, Aaron Bono wrote:
>
> They have different data. The fast one has about 150 rows and the slow one
> has about 40 rows. The field in question here, the branch_id, is a
> BIGSERIAL in both.
I'd be astonished if a table of 40 rows ever got index scanned.
"Aaron Bono" <[EMAIL PROTECTED]> writes:
> 9. -> Seq Scan on branch (cost=0.00..4.72 rows=1
> width=1281) (actual time=130129.988..157492.057 rows=1 loops=1)
> 10.Filter: ((start_day <= now()) AND
> ((end_day IS NULL) OR (end_day >= now())
On 5/5/07, Andrew Sullivan <[EMAIL PROTECTED]> wrote:
On Sat, May 05, 2007 at 04:05:52PM -0500, Aaron Bono wrote:
> I have two schemas, both with the exact same DDL. One performs great
and
Do they have the same data?
They have different data. The fast one has about 150 rows and the slow o
On Sat, May 05, 2007 at 04:05:52PM -0500, Aaron Bono wrote:
> I have two schemas, both with the exact same DDL. One performs great and
Do they have the same data?
> I have
> checked and there IS an index, specifically a primary key index, on the
> branch_id in both schemas so I cannot figure ou
Scott Marlowe <[EMAIL PROTECTED]> writes:
> Daniel CAUNE <[EMAIL PROTECTED]> Said:
>> I was wondering when it is better to choose sequence, and when
>> it is better to use serial.
> One reason for using serial versus sequence is that a serial gives you
> automatic dependency tracking.
Note that
Daniel CAUNE <[EMAIL PROTECTED]> Said:
> I was wondering when it is better to choose sequence, and when
> it is better to use serial. The serial type is a sequence with
> default parameters
(http://www.postgresql.org/docs/8.2/static/datatype-numeric.html#DATATYPE-SERIAL).
> Actually, I never
"Omkar Rath" <[EMAIL PROTECTED]> writes:
> Say there is a stored procedure i.e FUNCTION sp_foo(...) which has say,
> SQL commands (any of SELECT,INSERT,UPDATE,DELETE) in its body, say S1
> followed by S2 then S3 Furthermore, execution of statement S2
> results in trigger functions getting invok
"cristi" <[EMAIL PROTECTED]> writes:
> What is wrong here?
> insert into table_name (field_name) values (select
> setval('sequence_name')-1) as currval);
Either too few parentheses, or too many ;-)
You could write this as an INSERT/SELECT:
insert into table_name (field_name)
select setval('seq
On Fri, Aug 15, 2003 at 12:32:36PM +0300, cristi wrote:
> What is wrong here?
>
> insert into table_name (field_name) values (select
> setval('sequence_name')-1) as currval);
This should be better:
INSERT INTO table_name (field_name) VALUES (nextval('sequence_name'));
--
%!PS
2
On Fri, 15 Aug 2003, cristi wrote:
> What is wrong here?
>
> insert into table_name (field_name) values (select
> setval('sequence_name')-1) as currval);
Your probably want this instead:
insert into table_name (field_name) values (nextval('sequence_name'));
The reason why your insert fail ab
> >A trigger (maybe a rule) is the way to go about this.
> >
> >The alternative is to teach the bad clients to use DEFAULT rather than
> >NULL when they expect the GENERATOR to create the value for them.
> >
> Hmm, Rod, there really seems a demand for the GENERATOR feature :-)
> Do you see any perf
On Wed, 2003-07-02 at 11:30, Ralf Werny wrote:
> Hi,
> many clients like webmin and openoffice makes an
> INSERT NULL if i give no value for a field because it is a sequence.
> Is there a better way to solve this problem as using a trigger ?
A trigger (maybe a rule) is the way to go about th
select relname as table, attname as column from pg_class c join pg_attribute
a on c.oid=a.attrelid join pg_attrdef d on a.attnum=d.adnum where
adsrc='nextval(\'"SEQUENCE_NAME_SEQ"\'::text)'\ AND d.adrelid=c.oid;
There may be a more efficient query, but I wasn't too worried about figuring
it out...
Hi Tom,
Here is the output from 'select version()'
PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.95.2
Cheers
Rudi.
Tom Lane wrote:
>Rudi Starcevic <[EMAIL PROTECTED]> writes:
>
>
>>Just a quick one on the length of the name of a sequence.
>>...
>>However the sequence created is nam
> > However the sequence created is named :
> > eselect_maincategory_maincat_id ( the '_seq' is lopped off )
>
> What version are you running? Anything recent will keep the '_seq'
> and lop elsewhere.
Not if he's manually creating a sequence name that's too long - it will just
truncate it me
Rudi Starcevic <[EMAIL PROTECTED]> writes:
> Just a quick one on the length of the name of a sequence.
> ...
> However the sequence created is named :
> eselect_maincategory_maincat_id ( the '_seq' is lopped off )
What version are you running? Anything recent will keep the '_seq'
and lo
Hi Rudi,
Unless you redefine it before compiling, postgres has a built-in limit of 31
characters for names. Increasing this has a performance penalty, but it
might happen for 7.3 due to some improvements in the performance area.
BTW, the best way to do a sequence primary key is lik ethis:
crea
dear subha,
Use explicit ORDER BY if u want to order the records
by some column.
otherwise the order of output from a select stmt is undefined.
bu generally it is found the the last updated record comes last.
On Wednesday 26 June 2002 17:17, Subhashini Karthikeyan wrote:
> hi all
>
>
> In post
On Wed, 26 Jun 2002, Subhashini Karthikeyan wrote:
> In postgresql 7.1.3
>
> i am updateing a row. it is a 4th record.
> after updation if i am firing a select query it is
> coming as a last record ..what shall i do to avoid
> that..
> any help appriciated
If I understand the complaint, use an
> > binary_data=# create sequence test;
> > CREATE
> > binary_data=# select nextval('test');
> > NOTICE: test.nextval: sequence was re-created
>
> Um, how did you get that NOTICE? I don't see it.
This is version 7.0.3. I deleted the sequence first.
> Anyway, the answer to your question is tha
Grant <[EMAIL PROTECTED]> writes:
> Why is the following like it is? I would think that nextval would return 2
> in both instances, am I missing something here? :) Thanks!
> binary_data=# create sequence test;
> CREATE
> binary_data=# select nextval('test');
> NOTICE: test.nextval: sequence was
On Mon, 21 May 2001, gabi munteanu wrote:
> I have the following problem.
>
> I have a table [friends] and it looks like this:
>id serial
>name varchar(25)
>phone varchar(15)
> After I created it tehre is also a sequence that generates me the ids
> friens_id_s
39 matches
Mail list logo