Re: [SQL] table constraints

2005-02-28 Thread Casey T. Deccio
On Mon, 2005-02-28 at 18:01 -0700, Andrew - Supernews wrote: > The CHECK is obviously being evaluated prior to the actual insertion > of > the record, whereas the logic of your function clearly expects to be > evaluated after the insertion. > I finally came to that conclusion just a few minutes b

Re: [SQL] AutoCommit and DDL

2005-02-28 Thread Andrew - Supernews
On 2005-03-01, Don Drake <[EMAIL PROTECTED]> wrote: > I don't think it would be easy to duplicate since our code base is > quite extensive. > > Basically, what was happening was a script would first open a database > connection (AutoCommit turned off by default), create a few objects > (that also o

Re: [SQL] table constraints

2005-02-28 Thread Andrew - Supernews
On 2005-02-28, "Casey T. Deccio" <[EMAIL PROTECTED]> wrote: > However, the example I provided was contrived and was used merely to > show the discrepancy that I'm finding with using the function as a > constraint. In the larger example, things are a bit more complex, and > I've found using such a

Re: [SQL] AutoCommit and DDL

2005-02-28 Thread Don Drake
I don't think it would be easy to duplicate since our code base is quite extensive. Basically, what was happening was a script would first open a database connection (AutoCommit turned off by default), create a few objects (that also opened independent db connections), the objects would run querie

Re: [SQL] SQL error: function round(double precision, integer) does

2005-02-28 Thread Tom Lane
"TJ O'Donnell" <[EMAIL PROTECTED]> writes: > Is there some fundamental reason for round(dp) but round(numeric,int)? I think the main argument against supporting round(dp,int) is that the result would be inherently inexact (at least for int>0). regards, tom lane --

Re: [SQL] table constraints

2005-02-28 Thread Casey T. Deccio
On Mon, 2005-02-28 at 13:20 -0700, Bruno Wolff III wrote: > On Mon, Feb 28, 2005 at 11:28:30 -0800, > "Casey T. Deccio" <[EMAIL PROTECTED]> wrote: > > > > In this case each bldg has an owner associated to it, and each > animal > > lives in some bldg. Each owner has exactly one own favorite anima

Re: [SQL] table constraints

2005-02-28 Thread Bruno Wolff III
On Mon, Feb 28, 2005 at 11:28:30 -0800, "Casey T. Deccio" <[EMAIL PROTECTED]> wrote: > > In this case each bldg has an owner associated to it, and each animal > lives in some bldg. Each owner has exactly one own favorite animal out > of all the bldgs owned by him. So the constraint added to ea

[SQL] table constraints

2005-02-28 Thread Casey T. Deccio
Hi, I am running PostgreSQL 7.4.7. I am having some issues with a constraint for one of my database tables. The code snippet below outlines the code and its output (output is commented). In this case each bldg has an owner associated to it, and each animal lives in some bldg. Each owner has ex

Re: [SQL] diference in dates in minutes

2005-02-28 Thread Joel Fradkin
Sorry you are correct again it is TimeStamp not date. So maybe that is why it appeared to work ok. I will do as you suggest and play around with it before I accept it is a perfect solution, but it appeared to do what I was looking for (figure the difference in minutes). Joel Fradkin Wazagua, In

Re: [SQL] AutoCommit and DDL

2005-02-28 Thread Michael Fuhr
On Sun, Feb 27, 2005 at 07:55:35PM -0600, Don Drake wrote: > The problem has to do with multiple concurrent connections to the > server causing problems. I've removed the concurrent connections and > now this works. Strange. Can you elaborate? Can you describe the scenario with enough detail t

Re: [SQL] AutoCommit and DDL

2005-02-28 Thread Michael Fuhr
On Sun, Feb 27, 2005 at 11:55:37AM -0600, Don Drake wrote: > I know it's not failing, I have the server logging the commands and > there are no errors. > > The only change made was turning AutoCommit on. Have you used any of DBI's tracing capabilities? Could you post a simple test case? The fo

Re: [despammed] [SQL] SQL error: function round(double precision, integer) does not exist

2005-02-28 Thread Andreas Kretschmer
am 27.02.2005, um 15:26:07 -0800 mailte TJ O'Donnell folgendes: > I received the following error when executing a SQL statement: > > SQL error: > ERROR: function round(double precision, integer) does not exist > > In statement: > > select id,smiles,smarts,parameter,oe_count_matches(smiles,smar

Re: [SQL] SQL error: function round(double precision, integer) does

2005-02-28 Thread Richard Huxton
TJ O'Donnell wrote: I received the following error when executing a SQL statement: SQL error: ERROR: function round(double precision, integer) does not exist In statement: select id,smiles,smarts,parameter,oe_count_matches(smiles,smarts) as count, round((parameter*oe_count_matches(smiles,smarts))

Re: [SQL] Postgres 8 - problem: invalid input syntax for integer

2005-02-28 Thread Richard Huxton
mauro wrote: What number does '' represent? 'No response' value... Would've been better to have a genuine response_provided flag, but then you obviously know that. Who is providing an empty string where you've asked for a number, and why not trap this error (or store a NULL)? You are certainly r

Re: [SQL] SQL error: function round(double precision, integer) does not exist

2005-02-28 Thread Josh Berkus
TJ, > SQL error: > ERROR: function round(double precision, integer) does not exist > http://www.postgresql.org/docs/7.4/static/functions-math.html > show that round(numeric,int) should work ok. > If I use round() without a second argument, it works OK, but > this gives a loss of precision which

Re: [SQL] SQL error: function round(double precision, integer) does not exist

2005-02-28 Thread Din Adrian
the round sintax is round(numeric,int) not round (double,int) you must cast the value into numeric: ex: round (cast(doublecolumn as numeric),2) should work ok Adrian Din, Om Computer & SoftWare On Sun, 27 Feb 2005 15:26:07 -0800, TJ O'Donnell <[EMAIL PROTECTED]> wrote: I received the following err

Re: [SQL] Junk queries with variables?

2005-02-28 Thread Sean Davis
- Original Message - From: "Steve Valaitis" <[EMAIL PROTECTED]> To: "KÖPFERL Robert" <[EMAIL PROTECTED]>; Sent: Thursday, February 24, 2005 12:15 PM Subject: Re: [SQL] Junk queries with variables? > In pgadmins SQL-window SQL is the 'language' of choice. Or it is rather the only langua

Re: [SQL] Read count ?

2005-02-28 Thread Aarni Ruuhimäki
Hi, Thanks Ragnar. This, and an other GROUP BY + name query within output got me there. SELECT DISTINCT news_id, news_header, segment, segment_id, count(*) FROM news_table NATURAL JOIN segments_table NATURAL JOIN read_history WHERE account_id = #Url.account_id# GROUP BY news_id, news_heade

Re: [SQL] SQL error: function round(double precision, integer) does

2005-02-28 Thread TJ O'Donnell
I got round(numeric,int) working OK, but it's got me thinking (a dangerous thing!). Is there some fundamental reason for round(dp) but round(numeric,int)? Shouldn't they be, at least, consistent, having round(numeric) or round(dp,int)? Am I missing something? Thanks, TJ Michael Fuhr wrote: On Sun,

Re: [SQL] SQL error: function round(double precision, integer) does not

2005-02-28 Thread Christoph Haller
TJ O'Donnell wrote: > > I received the following error when executing a SQL statement: > > SQL error: > ERROR: function round(double precision, integer) does not exist > > In statement: > > select id,smiles,smarts,parameter,oe_count_matches(smiles,smarts) as count, > round((parameter*oe_coun

Re: [SQL] diference in dates in minutes

2005-02-28 Thread Joel Fradkin
Yea I probably forgot respond to all. I agree (specialy for this topic). In any case, I have dates not time (dates with times). I did not use datevar::date - date2::date, I did datevar - datevar2 and it appeared to work. Since the dates I was comparing were over a year apart the number in secs was

Re: [SQL] SQL error: function round(double precision, integer) does

2005-02-28 Thread TJ O'Donnell
Thanks everyone. Your tips about casting my arg to round() as ::numeric worked just fine. I guess I was surprised that plpgsql didn't that on it's own! I'm used to too many forgiving c compilers, and such. TJ Christoph Haller wrote: TJ O'Donnell wrote: I received the following error when executi

Re: [SQL] diference in dates in minutes

2005-02-28 Thread Bruno Wolff III
On Mon, Feb 28, 2005 at 09:09:09 -0500, Joel Fradkin <[EMAIL PROTECTED]> wrote: > Yea I probably forgot respond to all. I agree (specialy for this topic). > > In any case, I have dates not time (dates with times). It really helps if you use precise language when discussing problems. date, time

Re: [SQL] SQL error: function round(double precision, integer) does not exist

2005-02-28 Thread Michael Fuhr
On Sun, Feb 27, 2005 at 03:26:07PM -0800, TJ O'Donnell wrote: > ERROR: function round(double precision, integer) does not exist [snip] > The functions described at: > http://www.postgresql.org/docs/7.4/static/functions-math.html > show that round(numeric

Re: [SQL] Software for database-visualisation

2005-02-28 Thread Przemyslaw Slupkowski
Maybe would you like http://www.dbvis.com/products/dbvis/ it's can vizualize. But maybe you want some CASE tool like Sybase PowerDesigner?? - Original Message - From: "Sean Davis" <[EMAIL PROTECTED]> To: "Richard Huxton" Cc: ; "Kai Hessing" <[EMAIL PROTECTED]> Sent: Thursday, February 2

Re: [SQL] Software for database-visualisation

2005-02-28 Thread Kai Hessing
Sean Davis schrieb: > If you mean literally visualizing the ERD, you can look at > SQL::Translator (on cpan) which can draw fairly complex ERDs and output > as graphics (I forget the supported formats) I'll have a look at it. Thank you both! -- GnuPG-PublicKey -> http://www.hobsons.de/pgp/

Re: [SQL] Advanced SELECT

2005-02-28 Thread Kai Hessing
Richard Huxton schrieb: > Search the mailing-list archives for "custom aggregate concat" and > you'll quickly find an example of how to write your own custom aggregate > (like SUM()). > > Warning - I don't think you can guarantee the order of elements in the > aggregated sectors. Thank you ver

Re: [SQL] Postgres 8 - problem: invalid input syntax for integer

2005-02-28 Thread mauro
> What number does '' represent? 'No response' value... > Does that mean a string of '/2' should equal your number divided by two? right, but it is never required. > If not, why not? because I use it to GROUP BY values. > Who is providing an empty string where you've asked for a number, and > why

[SQL] SQL error: function round(double precision, integer) does not exist

2005-02-28 Thread TJ O'Donnell
I received the following error when executing a SQL statement: SQL error: ERROR: function round(double precision, integer) does not exist In statement: select id,smiles,smarts,parameter,oe_count_matches(smiles,smarts) as count, round((parameter*oe_count_matches(smiles,smarts)),2) as psa,tpsa(smil

Re: [SQL] Junk queries with variables?

2005-02-28 Thread Steve Valaitis
> > In pgadmins SQL-window SQL is the 'language' of choice. Or it is > rather the > only language. Thus if you intend to program plTk or PL/pgSQL, there's no > way around defining a function. > > (At first you have to define a new language in your schema) I'm a little confused, is there no way aro