Re: [SQL] Localization
GRIMOIS Eric writes: > Is there a simple way to localize in foreign language error messages without > modifying and compiling the sources again ? Depends on what compilation options you used to begin with. Obviously, if you didn't include the feature, it's not there. In any case, the current state of the French translation is pretty limited. Feel free to help. > It should be useful for final users who don't read Shakespeare in the > original version ;) But it's so much better. :) -- Peter Eisentraut [EMAIL PROTECTED] ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [SQL] bit field changes in 7.2.1
Kevin Brannen writes: > EXCEPT that now fails in 7.2.1 (I just upgraded this afternoon). It > forces me to use "b'00'" instead of "b'0'::bit(6)". Which is a problem why? > Searching thru the docs, I find a note that says: > > --- > Note: Prior to PostgreSQL 7.2, BIT type data was zero-padded on the > right. This was changed to comply with the SQL standard. To implement > zero-padded bit strings, a combination of the concatenation operator and > the substring function can be used. > --- > > Obviously the source of my problem. However, whoever wrote that note > didn't say how to do it (examples are *SO* useful), and I can't imagine > the solution. In your case the solution is to type the six zeroes. The comment referred to cases where the results of computations needed to be forced to the right length, in which case you could use something like substring(computation() || b'00' for 6) The question whether the constant should go before or after the computation, and whether it should be zeros or ones is a matter of taste, which is why an example has been omitted. -- Peter Eisentraut [EMAIL PROTECTED] ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Can this be done with sql?
Hi, You cannot easily return datasets from stored procedures. there has been lots of discussion on it. regds mallah. > yes, thank you, that may help but unfortunately there are are few more > problems to face. > > 1. I will need to select groups from anywhere in the table so i cannot > assume that 1 will be the start number. They will be contigous however so i > can use another query top get the start number but is it possible to do it > with just one select? > > 2. I need to display not just aggregates but the first and last value in > the group for two of the fields. I mean by this that i need > opening_value(field1) and closing_value(field2). > > 3. If this needs to be done via stored procedure how do i get it to return > a result set. I've tried setof record but it doesn't work. > > thanks > > > > ---(end of broadcast)--- > TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] Is Dropping a column "CHECK" constraint possible?
Hi , i want to enforce that a coulumn 'imp' shud either contain valid data or no data at all. by valid data i mean data having at least one non whitespace character. will this constraint be approprote for accomplishing it? tradein_client=> ALTER TABLE t_a ADD CHECK ( length( btrim(imp) ) > 1 or imp is NULL ); regards mallah. On Saturday 06 July 2002 10:05, Christopher Kings-Lynne wrote: > > can anyone please help? > > i have a to drop a check contstraint from a column. eg > > > > tradein_clients=# \d t_a > >Table "t_a" > >Column | Type | Modifiers > > +-+--- > > company_id | integer | > > exp| text| > > imp| text| > > Check constraints: "$1" (length(imp) > 1) > >"aq" (length(imp) > 1) > > ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
[SQL] Bad SUM result
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have an invoice database that has two tables one for invoices and one for payments. I want to get the account balance for a client by subtracting the sum of all payments from the sum off all invoices for that client. Here is the SQL that I thought should work. SELECT SUM(t0.totalprice)-SUM(t1.paymentamount) FROM invoices t0, payments t1 WHERE t0.custnumber='1' AND t1.custnumber='1' It works fine if there is only one invoice and one payment but as soon as there is more then one of either it screws up. For each match found in payments the invoice sum is added to the total. So if client 1 purchased a $100 item then maid a $10 payment the SQL would return the balance of $90 just fine. When the client makes a second payment of $15 the balance is $75 but this SQL returns ($100+$100)-($10+$15) = $175. A third payment of $1 would return ($100+$100+$100)-($10+$15+$1) = $274. Could some one explain this to me and recommend an SQL command that would work please? I could do this using a temp table but that would be very messy as I would really like it to be a single SQL command. - -- Roy Souther <[EMAIL PROTECTED]> http://www.SiliconTao.com Linux: May the source be with you. -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAj0oo9MACgkQCbnxcmEBt43qFQCgtjCs7khKGH+2LYd78O9mA3h4 vDQAn0GkKkuYl1Kybgm/ITO4LbO1WWLX =1G4R -END PGP SIGNATURE- ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Bad SUM result
On Sun, 7 Jul 2002, Roy Souther wrote: > I have an invoice database that has two tables one for invoices and one for > payments. I want to get the account balance for a client by subtracting the > sum of all payments from the sum off all invoices for that client. > > Here is the SQL that I thought should work. > SELECT SUM(t0.totalprice)-SUM(t1.paymentamount) FROM invoices t0, payments t1 > WHERE t0.custnumber='1' AND t1.custnumber='1' > > It works fine if there is only one invoice and one payment but as soon as > there is more then one of either it screws up. For each match found in > payments the invoice sum is added to the total. So if client 1 purchased a > $100 item then maid a $10 payment the SQL would return the balance of $90 > just fine. When the client makes a second payment of $15 the balance is $75 > but this SQL returns ($100+$100)-($10+$15) = $175. A third payment of $1 > would return ($100+$100+$100)-($10+$15+$1) = $274. Right, because you're doing a join that ends up with 100 | 10 100 | 15 100 | 1 as the effective rows. > Could some one explain this to me and recommend an SQL command that would work > please? I could do this using a temp table but that would be very messy as I > would really like it to be a single SQL command. Maybe something like: select sum(amt) from (select custnumber, totalprice as amt from invoices union select custnumber, -paymentamount as amt from payments) as c where custnumber='1'; ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[SQL] INSERT only under certain conditions (SELECT)
Hi, I want to insert a row only under condition that there isn't already another row with similar values -- something like a INSERT INTO ... WHERE NOT EXISTS (SELECT ...)? Hoping for help, joachim ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly