Re: [SQL] save me from an unconstrained join

2005-03-30 Thread Richard Huxton
Robert Treat wrote: It actually does what I want... but it offends my database sensibilities... :-) Heres the basics of the tables involved: CREATE TABLE bds_filesize ( bds_filesize_id serial name text NOT NULL, byte_limit integer NOT NULL, slots integer NOT NULL ); CREATE TABLE sof

Re: [SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-30 Thread Lin Kun Hsin
below is the sql schema. i hope it will help. i want the top 3 score students in every class below is the original sql solution, but when we have 100 class , we have to union 100 times? have any better performance statement? select * from ( (select * from allscore where class = 'a' order by sc

Re: [SQL] delphi access question

2005-03-30 Thread Lin Kun Hsin
hello I can run your sql statement in PgAdmin,too. so your statement should be OK! Can you post more example about add to result, let us have idea about your question. I think you can try to set char(1) to char(2), try it will useful.. -- http://alumni.cyut.edu.tw Open WebMail Project (http:/

Re: [SQL] Postgres 7.3 migrate to 8.0 date problems.

2005-03-30 Thread Michael Fuhr
On Wed, Mar 30, 2005 at 04:23:34PM -0500, Robert Treat wrote: > > Would it be possible to use a BEFORE trigger to reformat the -DD-MM > date to -MM-DD ? The error I see on 7.4 is ERROR: date/time field > value out of range: "2005-14-01" so ISTM you could do some data > manipulation if you

Re: [SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-30 Thread Jaime Casanova
On Thu, 31 Mar 2005 10:29:16 +0800, "æï[é" <[EMAIL PROTECTED]> wrote: > i have a little question, how to get 3 higher score student in every class. > Data looks like as below > > problem: > idclass score > john a 100 > jenny a 70 >

[SQL] A SQL Question About distinct, limit, group by, having, aggregate

2005-03-30 Thread 林[鋅
i have a little question, how to get 3 higher score student in every class. Data looks like as below problem: id class score johna 100 jenny a 70 ken a 59 maryb 85 jacky

Re: [SQL] New record position

2005-03-30 Thread Chris Browne
[EMAIL PROTECTED] writes: > Why it? I can't undestand why the new record location was change. Shouldn't it > apper at the LAST record??? > What need I do?? SQL only imposes an order on the return set if you add an "ORDER BY" clause. You can't expect any particular order to either recur or NOT rec

Re: [SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread Greg Stark
Bruno Wolff III <[EMAIL PROTECTED]> writes: > It does look like you can only ADD and DROP constraints, not directly > alter or replace them. So making a reference deferable is go to require > a DROP and ADD which will need to recheck the constraint. I asked the same question a few days ago on pgs

Re: [SQL] delphi access question?

2005-03-30 Thread Joel Fradkin
Yea odd thing is if I use a table type object it see the fields so it is only with query objects. The same odbc works ok with my asp pages. I will see if I can figure out the zeos stuff. Something is not translating CHAR values correctly -- all the fields that you "see" are not char values. Hav

Re: [SQL] delphi access question?

2005-03-30 Thread Gregory S. Williamson
Something is not translating CHAR values correctly -- all the fields that you "see" are not char values. Have no idea off hand *why* this would be ... character encoding differences maybe ? Greg Williamson DBA GlobeXplorer LLC -Original Message- From: Joel Fradkin [mailto:[EMAIL PRO

Re: [SQL] Postgres 7.3 migrate to 8.0 date problems.

2005-03-30 Thread Robert Treat
On Mon, 2005-03-28 at 15:48, Scott Marlowe wrote: > On Mon, 2005-03-28 at 13:44, Thomas Seeber wrote: > > Hi, > > > > We were upgrading from postgres 7.3 -> 8.0 and having a little > > problems importing dates from some of our data sources. Say we have a > > date like '2004-17-05'. In postgres 7

[SQL] save me from an unconstrained join

2005-03-30 Thread Robert Treat
It actually does what I want... but it offends my database sensibilities... :-) Heres the basics of the tables involved: CREATE TABLE bds_filesize ( bds_filesize_id serial name text NOT NULL, byte_limit integer NOT NULL, slots integer NOT NULL ); CREATE TABLE software ( sof

[SQL] delphi access question?

2005-03-30 Thread Joel Fradkin
One of my applications is in Delphi 5. I just went to change it over to Postgres (from MSSQL). I am using odbc and something a bit odd is happening. I can run a sql statement ok, even in sql builder I see all the fields. But the returned result set appears to be missing some of the fields. So my ta

Re: [SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread Bruno Wolff III
On Wed, Mar 30, 2005 at 10:52:42 -0700, Michael Fuhr <[EMAIL PROTECTED]> wrote: > On Wed, Mar 30, 2005 at 11:52:32AM -0600, Bruno Wolff III wrote: > > > > What version of Postgres are you running? I think ALTER CONSTRAINT is a > > relatively recent addition. > > Where are you seeing ALTER CONST

Re: [SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread Michael Fuhr
On Wed, Mar 30, 2005 at 11:52:32AM -0600, Bruno Wolff III wrote: > > What version of Postgres are you running? I think ALTER CONSTRAINT is a > relatively recent addition. Where are you seeing ALTER CONSTRAINT? I don't see it in gram.y even in HEAD. -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread Bruno Wolff III
On Wed, Mar 30, 2005 at 12:33:11 +0200, [EMAIL PROTECTED] wrote: > On Wed, Mar 30, 2005 at 11:48:31AM +0200, PFC wrote: > > > > Checks the docs on ALTER TABLE ... ALTER CONSTRAINT ... > > ALTER CONSTRAINT? I did check for that, and it does not appear to > exist?! That's why I asked ... Wha

Re: [SQL] RE : Foreign key

2005-03-30 Thread Bruno Wolff III
You should keep the list copied unless you have a specific reason not to. This allows other people to help and learn from the discussion. On Wed, Mar 30, 2005 at 14:09:07 +0200, [EMAIL PROTECTED] wrote: > Hello, > > Thanks for your answers but i make the modifications, the same error returned.

Re: RE : [SQL] Foreign key

2005-03-30 Thread Michael Fuhr
On Wed, Mar 30, 2005 at 02:09:05PM +0200, [EMAIL PROTECTED] wrote: > > Thanks for your answers but i make the modifications, the same error returned. > Here my script : > ... > Create table Salariés (Nom_salarié VARCHAR(20), >Prénom VARCHAR(20), > Fonction VARC

Re: [SQL] New record position

2005-03-30 Thread lucas
Okay, I will use the "order by" clause. I was worried about it. I have thought that my database had crashed. Thank you. Quoting Oleg Bartunov : This is a feature of relational databases, you should explicitly specify ordering if you want persistent order. btw, why do you bothering ? Oleg

Re: [SQL] New record position

2005-03-30 Thread PFC
Why it? I can't undestand why the new record location was change. Shouldn't it apper at the LAST record??? What need I do?? Thank you. The SQL spec specifies that if you don't use ORDER BY, well, the records come out in any order they want. Actually it's the order they are on disk, which i

Re: [SQL] New record position

2005-03-30 Thread Oleg Bartunov
This is a feature of relational databases, you should explicitly specify ordering if you want persistent order. btw, why do you bothering ? Oleg On Wed, 30 Mar 2005 [EMAIL PROTECTED] wrote: Hello, I am using Slackware Linux 10, Postgresql 8.0.1. My computer had a incorrectly power down (l

[SQL] New record position

2005-03-30 Thread lucas
Hello, I am using Slackware Linux 10, Postgresql 8.0.1. My computer had a incorrectly power down (last week) and I have executed the vacuum command: VACCUM FULL ANALYZE VERBOSE; to recicle and verify my database. Before the power-down, all records had inserted into a table have displayed at LAST

Re: [SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread frank
On Wed, Mar 30, 2005 at 11:48:31AM +0200, PFC wrote: > > Checks the docs on ALTER TABLE ... ALTER CONSTRAINT ... ALTER CONSTRAINT? I did check for that, and it does not appear to exist?! That's why I asked ... Rgds, Frank ---(end of broadcast)--

Re: [SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread PFC
Checks the docs on ALTER TABLE ... ALTER CONSTRAINT ... On Wed, 30 Mar 2005 11:07:32 +0200, <[EMAIL PROTECTED]> wrote: Hello. Is it possible to change an FK constraint from NOT DEFERRABLE (the default) to DEFERRABLE without dropping and re-creating it? One idea that came up was to create a para

[SQL] can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE

2005-03-30 Thread frank
Hello. Is it possible to change an FK constraint from NOT DEFERRABLE (the default) to DEFERRABLE without dropping and re-creating it? One idea that came up was to create a parallel set of constraints which perform the same checks as the existing ones as DEFERRABLE (and then drop the old set), but t