Re: [SQL] I need some magical advice

2009-01-29 Thread Terry Fielder
and verify your query is going to do what you want before you clobber data. (or use a transaction, but if its a live database you don't want a transaction around locking users out) Terry Terry Fielder te...@greatgulfhomes.com Associate Director Software Development and Deployment Great Gulf

Re: [SQL] Case Insensitive searches

2008-08-06 Thread Terry Lee Tucker
done this but I have read about it. I'm sure it can be done. CREATE INDEX indtest_01 ON table_01 ((SUBSTRING(month_year, 3, 4) || SUBSTRING(month_year, 1, 2)) 2008/8/4 Terry Lee Tucker [EMAIL PROTECTED] On Monday 04 August 2008 11:09, Frank Bax wrote: Terry Lee Tucker wrote: On Monday

Re: [SQL] Case Insensitive searches

2008-08-04 Thread Terry Lee Tucker
? -- Terry Lee Tucker Turbo's IT Manager Turbo, division of Ozburn-Hessey Logistics 2251 Jesse Jewell Pkwy NE Gainesville, GA 30501 Tel: (336) 372-6812 Fax: (336) 372-6812 Cell: (336) 404-6987 [EMAIL PROTECTED] www.turbocorp.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] Case Insensitive searches

2008-08-04 Thread Terry Lee Tucker
On Monday 04 August 2008 11:09, Frank Bax wrote: Terry Lee Tucker wrote: On Monday 04 August 2008 10:05, Richard Broersma wrote: On Mon, Aug 4, 2008 at 6:54 AM, Mike Gould [EMAIL PROTECTED] wrote: In some db's if you use a lower() or upr() it will always do a table scan instead of using

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Terry Lee Tucker
On Thursday 24 April 2008 10:47, Bart Degryse wrote: Well, that's what it does afaikt. And what does afaikt mean? -- Terry Lee Tucker Turbo's IT Manager Turbo, division of Ozburn-Hessey Logistics 2251 Jesse Jewell Pkwy NE Gainesville, GA 30501 Tel: (336) 372-6812 Fax: (336) 372-6812 Cell

Re: [SQL] Authentification failed

2007-08-14 Thread Terry Fielder
Connecting as root may be ill advised (doing stuff as root is a bad idea unless one HAS to). All that notwithstanding, you need to setup the correct permissions to allow the connections you want in pg_hba.conf, usually is /var/lib/pgsql/data/pg_hba.conf Terry Terry Fielder [EMAIL

Re: [SQL] Getting pk of the most recent row, in a group by

2007-08-13 Thread Terry Fielder
Do you have a table of coupon types? Terry Terry Fielder [EMAIL PROTECTED] Associate Director Software Development and Deployment Great Gulf Homes / Ashton Woods Homes Fax: (416) 441-9085 Bryce Nesbitt wrote: I've got a table of coupons which have an expiration date. For each type

Re: [SQL] How to process inverted comma in EXECUTE 'insert into xxx values(...)

2007-05-15 Thread Nemo Terry
But I must use it in function,so... Do you have another solution? From: Rodrigo De Le�n [EMAIL PROTECTED] To: pgsql-sql@postgresql.org CC: Nemo Terry [EMAIL PROTECTED] Subject: Re: [SQL] How to process inverted comma in EXECUTE 'insert into xxx values(...)';? Date: Tue, 15 May 2007 01:25:25

Re: [SQL] How to process inverted comma in EXECUTE 'insert into xxx values(...)

2007-05-15 Thread Nemo Terry
quote_literal() works.Thanks a lot! From: Richard Huxton [EMAIL PROTECTED] To: Nemo Terry [EMAIL PROTECTED] CC: pgsql-sql@postgresql.org Subject: Re: [SQL] How to process inverted comma in EXECUTE 'insert into xxx values(...) Date: Tue, 15 May 2007 08:12:55 +0100 Nemo Terry wrote: But I

[SQL] How to process inverted comma in EXECUTE 'insert into xxx values(...)';?

2007-05-14 Thread Nemo Terry
Look at this problem: when execute 'insert into lse_installations values(' || ||obj_id|| || ',' || ||div|| || ',' || ||sub|| || ',' || ||obj_type|| || ',' || ||obj_name|| || ',' || ||pstcd|| || ',' || ||rdcd|| || ',' || ||blkno||

[SQL] How to use function PointN?

2007-05-07 Thread Nemo Terry
select PointN(envelope(polyline),1) from highway; return null,why? _ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com ---(end of broadcast)--- TIP 1: if posting/reading through

[SQL] Which function transform x,y to latitude/longitude?

2007-04-25 Thread Nemo Terry
Hi, For example x= 38356.62 y= 42365.19.how to transform it to latitude 1.399948, longitude 193.92644? Which function I could use? I don’t know the algorithm. Initial data is: (+proj=cass +a=6378137.0 +rf=298.257223563 +lat_0=1.287639n +lon_0=103.8516e +x_0=3 +y_0=3). Thanks a lot.

Re: [SQL] Which function transform x,y to latitude/longitude?

2007-04-25 Thread Nemo Terry
I just know the correct data must be longitude 103.926669,latitude0.111827. x,y from Cassini system. Could you give me the source code how you calculate.Thanks a lot! From: Michael Fuhr [EMAIL PROTECTED] To: Nemo Terry [EMAIL PROTECTED] CC: pgsql-sql@postgresql.org Subject: Re: [SQL] Which

Re: [SQL] migrating numeric to serial from MSSQL to postgres

2006-10-15 Thread Terry Fielder
not for many statements :) Terry Fielder [EMAIL PROTECTED] Associate Director Software Development and Deployment Great Gulf Homes / Ashton Woods Homes Fax: (416) 441-9085 Kenneth Gonsalves wrote: hi, am migrating a database from MSSQL to postgres. How would i migrate this: [Id] [numerc

Re: [SQL] About sequences that works BAD !!!!

2006-06-14 Thread Terry Lee Tucker
On Wednesday 14 June 2006 02:02 pm, Alexis Palma Espinosa [EMAIL PROTECTED] thus communicated: -- Hello everyone: -- -- -- -- We are working with serials fields and we found a problem with then: When we insert in a table that has e unique restrict, and this makes insert fails, the sequence

Re: [SQL] problem with uniques and foreing keys

2006-05-06 Thread Terry Lee Tucker
On Saturday 06 May 2006 01:27 pm, kernel.alert kernel.alert [EMAIL PROTECTED] thus communicated: -- Hi list... -- -- Please i have a problem with this... -- -- I create the follow tables... -- -- -- -- CREATE TABLE empresa ( -- id_empresa

Re: [SQL] Simple plpgsql question

2006-04-14 Thread Terry Lee Tucker
On Thursday 13 April 2006 11:38 pm, Todd Kennedy [EMAIL PROTECTED] thus communicated: -- Hi, -- -- I have, what I hope to be, a simple question about plpgsql. -- -- I have a trigger on a table right now that updates a count everytime -- that a new record is entered into a database (or removed).

Re: [SQL] concatenation with a null column (using ||) nulls the result?

2006-04-10 Thread Terry Lee Tucker
On Monday 10 April 2006 05:55 pm, Alvaro Herrera saith: Neil Harkins wrote: Note: The cabinets_description for the 548-4th-Cab1 row is , not NULL, hence it being displayed. Is this standard SQL behavior? Yes; something || NULL yields NULL. If you want NULL to behave as for the purpose

Re: [SQL] Query from shell

2006-04-06 Thread Terry Lee Tucker
On Thursday 06 April 2006 02:37 pm, Judith saith: Hi every body, somebody can show me hot to execute a query from a shell thanks in advanced!!! ---(end of broadcast)--- TIP 4: Have you searched our list archives?

Re: [SQL] Custom type

2006-03-22 Thread Terry Lee Tucker
On Wednesday 22 March 2006 03:25 pm, Daniel Caune saith: Hi, How can I enter description for my custom types? \dT provides information such as schema, name, and description for all the registered types and custom types. I would like to provide a description for each custom type I create.

Re: [SQL] Merry Xmas and a Happy New Year

2005-12-23 Thread Terry Lee Tucker
Merry Christmas to you. On Friday 23 December 2005 09:16 am, Achilleus Mantzios saith: to All! -- -Achilleus ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] casting character varying to integer - order by numeric

2005-10-19 Thread Terry Fielder
(t.section, text()), t.section And if the field section can actually START with an alpha, then to prevent to_number from failing do this: to_number(textcat('0', t.section), text()), t.section Terry Bryce W Nesbitt wrote: How can I force a character field to sort as a numeric field

Re: [SQL] query

2005-03-17 Thread Terry Fielder
now() returns a timestamp. Cast it to a date and then you can subtract days. e.g. select now()::date -1 Terry Chandan_Kumaraiah wrote: Hi, In oracle we write sysdate-1 For example,we write a query (select * from table1 where created_date=sysdate-1).Whats its

[SQL] Simple Question

2005-01-11 Thread Terry Lee Tucker
Hello: I'm trying to figure out how to convert a floating point value into an interval of time. I'm calculating the time required to drive from point A to point B. For the sake of this question, we'll just say it is miles/speed. So: drv_time = 478 / 45.0; The value of this is:

Re: [SQL] Simple Question

2005-01-11 Thread Terry Lee Tucker
other ways, I'd be interested in see that too. On Tuesday 11 January 2005 04:42 pm, Terry Lee Tucker saith: Hello: I'm trying to figure out how to convert a floating point value into an interval of time. I'm calculating the time required to drive from point A to point B. For the sake

Re: [SQL] Simple Question

2005-01-11 Thread Terry Lee Tucker
Thank you for the reply in spite of the subject. On Tuesday 11 January 2005 05:15 pm, Michael Fuhr saith: On Tue, Jan 11, 2005 at 04:42:21PM -0500, Terry Lee Tucker wrote: Subject: [SQL] Simple Question Please use a more descriptive subject -- think about how somebody looking at a list

Re: [SQL] Simple Question

2005-01-11 Thread Terry Lee Tucker
)::int4::reltime::interval ; interval -- 10:37:20 (1 row) I don't know if ::int4::reltime::interval is the best way to end up with an interval, but its the only way I could figure out how to do it off the top of my head. On Tue, 2005-11-01 at 16:42 -0500, Terry Lee Tucker wrote

Re: [SQL] NULLS and string concatenation

2004-11-25 Thread terry
There is an easy solution anyway, use coalesce to ensure you are never returning a null result for any components of the concat. e.g. select 'some text, blah:' || coalesce(NULL, '') equates to 'some text, blah:' || '' hence 'some text, blah:' Terry Fielder Manager Software Development

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Terry Lee Tucker
Slick ;o) This goes in my tool kit... On Friday 19 November 2004 03:03 pm, Gregory S. Williamson saith: Someone on this list provided me with a rather elegant solution to this a few weeks ago: CREATE OR REPLACE FUNCTION text_concat_nulls_with_an_embedded_space(text, text) RETURNS text AS

Re: [SQL] next integer in serial key

2004-07-29 Thread terry
) | not null Hence SELECT nextval('public.gbs_floorplans_floorplan_id_seq'::text) Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf

Re: [SQL] next integer in serial key

2004-07-22 Thread terry
a transaction is NOT sufficient, you need an explicit lock on the sequence. I do not recommend the 2nd method, too much can go wrong. Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From

Re: [SQL] next integer in serial key

2004-07-22 Thread terry
are done OR 2) NONE of the inserts are done (Note it doesn't roll back the sequence, that id on rollback would become unused) Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From

Re: [SQL] = operator vs. IS

2004-06-28 Thread terry
. NOTE: A related topic is OUTER JOIN's which is how the above join would properly be implemented Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From: [EMAIL PROTECTED] [mailto

[SQL] Formatting Functions and Group By

2004-04-13 Thread Terry Brick
Hi, I'm porting a bunch of queries from MySQL to Postgres 7.4 and am having a problem with one particular area. For example, a query like this works in MySQL: select to_char(myCol,'Mon YY') from myTable group by to_char(myCol,'MM ') order by to_char(myCol,'MM ') Postgres will

Re: [SQL] Formatting Functions and Group By

2004-04-13 Thread Terry Brick
Thank you both for your responses. That's just what I needed and thanks for catching my mistake Tom. And may I say that I am VERY happy to be moving to Postgres. The lack of a native Win32 version was thing only thing holding us back from Postgres previously. I think this is the only

Re: [SQL] Trying to make efficient all vendors who can provide all items

2004-03-09 Thread terry
Of all the proposed solutions, this appears to run the fastest, and not require the creation of an additional table. Thanks! Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From

[SQL] Trying to make efficient all vendors who can provide all items

2004-03-08 Thread terry
AND items_2.item_id = 'item_5' Yep, both my solutions are pretty ugly, especially in situations where my list of items that need to be provided grow large. There must be a better way. Can anyone help me with this? Thanks Terry Fielder Manager Software Development and Deployment Great Gulf Homes

Re: [SQL] Trying to make efficient all vendors who can provide all items

2004-03-08 Thread terry
misunderstand your query? Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From: Jeremy Semeiks [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 2:07 PM To: [EMAIL PROTECTED] Cc

Re: [SQL] Trying to make efficient all vendors who can provide all items

2004-03-08 Thread terry
That's pretty nifty code. It certainly looks nicer, and looks like it would work providing vendor_iditem_id is the pk of item_vendors (and it is). I will let you know if it runs any faster... Thanks Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes

[SQL] Return relation table data in a single value CSV

2004-02-17 Thread terry
, and the ',' is wrapped with a case statement to hide the comma if there are no further elevations. It gets very messy very fast as and further I end up hard coding the max number of elevations. Any ideas? Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods

Re: [SQL] CHAR(n) always trims trailing spaces in 7.4

2004-02-17 Thread terry
select 'x'||' '||'x' should produce xx, but it produces x x. INCORRECT This select 'x'||' '::char ||'x' Should produce xx This select 'x'||' '||'x' is restateable as select 'x'|| ' '::text ||'x' And the || operand for text is not dropping the extra spaces hence correctly x x Terry

[SQL] Novice SQL Question

2004-02-02 Thread Terry Lee Tucker
I need to the following query: select distinct event_code, level from logs join stat on (stat.prime is not null) where order_num = 130680; Ok, no problem. Does exactly what I want; however, I need to sort this is a particular way to get the right results. When I try to add the order by clause,

Re: [SQL] Novice SQL Question

2004-02-02 Thread Terry Lee Tucker
To answer my own question: I discoverd that the order by fields had to be in the select list. Apparently, this is a requirement when using DISTINCT. On Monday 02 February 2004 05:38 pm, Terry Lee Tucker wrote: I need to the following query: select distinct event_code, level from logs join

Re: [SQL] How to quote date value?

2003-11-28 Thread terry
If you want an explicit date, then cast it like this: SELECT '1/11/2003'::date AS InvoiceDate; Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From: [EMAIL PROTECTED] [mailto

Re: [SQL] Select and functions

2003-11-05 Thread terry
,'' '',); RETURN NEW; END; ' Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Stephen J

Re: [SQL] NOT and AND problem

2003-07-17 Thread terry
DELETE FROM myTable WHERE NOT (SELECT 1 FROM item WHERE myTable.item_id = item.item_id) AND NOT (SELECT 1 FROM ep WHERE myTable.group_id = ep.group_id); Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085

Re: [SQL] NOT and AND problem

2003-07-17 Thread terry
1 FROM ep WHERE myTable.group_id = ep.group_id); Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED

[SQL] Parameterized Views on 7.3

2002-12-21 Thread Terry Yapt
Hello all, Are parameterized views already fully functional in 7.3 or I must use fuctions returning rows set ? I have been looking for that in developer documentacion /7.3.1) and in the google groups but I haven't had so many luck. Thanks. ---(end of

Re: [SQL] query optimization question

2002-11-07 Thread terry
, projects.marketing_name Terry Fielder Network Engineer Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Christoph Haller Sent: Thursday, November 07, 2002 3:57 AM To: [EMAIL PROTECTED] Cc: [EMAIL

Re: [SQL] primary keys

2002-11-07 Thread terry
of the primary key. Terry Fielder Network Engineer Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:pgsql-sql-owner;postgresql.org]On Behalf Of Huub Sent: Wednesday, November 06, 2002 9:19 AM To: [EMAIL PROTECTED] Subject: [SQL

FW: [SQL] query optimization question

2002-11-06 Thread terry
10 5 20 (if X had 4 lots, each of 5 deficiencies) Y 1 1 0 2 3 3 0 6 (each has eg 3 deficiencies in project Y) Terry Fielder Network Engineer Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] -Original

[SQL] Comparing Numeric and Double Precision (float8)..

2002-11-04 Thread Terry Yapt
Hello all, i DON'T know what is the proper forum to throw this question and I must to insist in this feature. Sorry. I have a lot of tables from Oracle 8i Databases with a lot of columns with numeric(x,0) definition. Ok.. I am traslating my oracle tables to PostgreSQL tables. But I am having

Re: [SQL] Comparing Numeric and Double Precision (float8)..

2002-11-04 Thread Terry Yapt
Great I don't know if my customers can wait until 7.3 official release, but I'll try to distract them a bit... :-\ Thanks a lot Bruno... Bruno Wolff III wrote: On Mon, Nov 04, 2002 at 09:11:30 +0100, Terry Yapt [EMAIL PROTECTED] wrote: When I compare a numeric(x,0) field

[SQL] query optimization question

2002-11-04 Thread terry
proj.division_id = '#variables.local_division_id#' AND NOT EXISTS (SELECT 1 FROM menu_group_projects WHERE menu_code = 'WA' AND division_id = proj.division_id AND project_id = proj.project_id AND status = 'I') ORDER BY proj.project_id Thanks in advance Terry Fielder Network Engineer Great

[SQL] Restricting a VIEW.

2002-10-19 Thread Terry Yapt
Hello all, I have a doubt. In the next example, I have a table with two columns: - DATE - MONEY And a VIEW which SUM's the money GROUPing by 'month/year' (I cut off the day)... Ok.. I would like to be able to SELECT * FROM VIEW.. but restricting by complete dates (dd/mm/)... (Last select

Re: [SQL] Limiting database size

2002-06-26 Thread terry
a database application that depends them. But then, M$ never takes any responsibility for the amount of disk space it wastes. terry ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge