Re: [SQL] How to max() make null as biggest value?

2010-04-20 Thread Pavel Stehule
2010/4/20 Pavel Stehule : > Hello > > 2010/4/14 Feixiong Li : >> Hi , guys , >> >> I am newbie for sql, I have a problem when using max() function, I need get >> null when there are null in the value list, or return the largest value as >> usual, who can do this? >> > > max()  returns max value of

Re: [SQL] Problem with insert related to different schemas

2010-04-20 Thread Gonzalo Aguilar Delgado
El mar, 20-04-2010 a las 10:34 -0600, Scott Marlowe escribió: > On Tue, Apr 20, 2010 at 10:32 AM, Gonzalo Aguilar Delgado > wrote: > > > >> Hi Everyone, > >> > >> I've come along with a problem that appeared with latest version of > >> Postgresql 8.4.2. > >> > >> I'm trying to insert a row in the

Re: [SQL] Problem with insert related to different schemas

2010-04-20 Thread Tom Lane
Gonzalo Aguilar Delgado writes: >> This is a select query. I don't think that's the right error message. > Yes, but IS the correct error message. The query being complained of appears to be a generated foreign key checking query. It's not surprising it would appear in the context of an insert.

Re: [SQL] How to max() make null as biggest value?

2010-04-20 Thread Tim Landscheidt
Feixiong Li wrote: > I am newbie for sql, I have a problem when using max() > function, I need get null when there are null in the value > list, or return the largest value as usual, who can do > this? > i.e. max([1,2,3,4,5]) => 5 > max([1,2,3,4,5,null]) => null You can cheat a bit: | tim=#

Re: [SQL] Problem with insert related to different schemas

2010-04-20 Thread Scott Marlowe
On Tue, Apr 20, 2010 at 10:32 AM, Gonzalo Aguilar Delgado wrote: > >> Hi Everyone, >> >> I've come along with a problem that appeared with latest version of >> Postgresql 8.4.2. >> >> I'm trying to insert a row in the analysis schema: >> > > This is an insert query: > > Yes it is... > > >> INSERT

Re: [SQL] Problem with insert related to different schemas

2010-04-20 Thread Gonzalo Aguilar Delgado
> > Hi Everyone, > > > > I've come along with a problem that appeared with latest version of > > Postgresql 8.4.2. > > > > I'm trying to insert a row in the analysis schema: > > > > This is an insert query: Yes it is... > > > INSERT INTO > > "analisys"."response_quality" > > ("uuid","id_su

Re: [SQL] Problem with insert related to different schemas

2010-04-20 Thread Scott Marlowe
On Wed, Apr 14, 2010 at 2:23 AM, Gonzalo Aguilar Delgado wrote: > Hi Everyone, > > I've come along with a problem that appeared with latest version of > Postgresql 8.4.2. > > I'm trying to insert a row in the analysis schema: > This is an insert query: > INSERT INTO > "analisys"."response_qualit

Re: [SQL] How to max() make null as biggest value?

2010-04-20 Thread Oliveiros
Howdy, Feixiong. I dunno if this results out of the box, but try something like this SELECT CASE WHEN (COUNT(*) <> COUNT("YourColumnName")) THEN NULL ELSE MAX("YourColumnName") END AS "" FROM t_your_table; I don't have an example table to test so this is "air code", but if you use count

Re: [SQL] How to max() make null as biggest value?

2010-04-20 Thread Pavel Stehule
Hello 2010/4/14 Feixiong Li : > Hi , guys , > > I am newbie for sql, I have a problem when using max() function, I need get > null when there are null in the value list, or return the largest value as > usual, who can do this? > max() returns max value of some column create table foo(a int); in

[SQL] Problem with insert related to different schemas

2010-04-20 Thread Gonzalo Aguilar Delgado
Hi Everyone, I've come along with a problem that appeared with latest version of Postgresql 8.4.2. I'm trying to insert a row in the analysis schema: INSERT INTO "analisys"."response_quality" ("uuid","id_survey_question","id_survey","id_survey_status","id_shop","survey_question_response","id_s

[SQL] How to max() make null as biggest value?

2010-04-20 Thread Feixiong Li
Hi , guys , I am newbie for sql, I have a problem when using max() function, I need get null when there are null in the value list, or return the largest value as usual, who can do this? i.e. max([1,2,3,4,5]) => 5 max([1,2,3,4,5,null]) => null thanks in advance! Feixiong feixion.

[SQL] creating a versioning system for sets?

2010-04-20 Thread Steve Lefevre
I'm working on a web app for a quality control checklist. I already have a table set up, but I have a hunch that our model is sub-optimal and I could get some better performance.I'm hoping someone on this list can help me think clearly about how to express this efficiently in SQL. Each checklist h

Re: [SQL] Re: CHECK constraints with plpgsql functions - check 'fires' BEFORE data modification?

2010-04-20 Thread Mario Splivalo
Tom Lane wrote: I think what Mario is actually complaining about is that partial unique indexes are not part of the SQL standard, and he wants a solution that at least gives the illusion that it might be portable to some other RDBMS in the future. Correct. As far as I can see there is no parti