[SQL] sql error creating function

2006-08-10 Thread TJ O'Donnell
When I psql -f f.sql I get the following error: psql:f.sql:10: ERROR: relation "fragset" does not exist CONTEXT: SQL function "fragments" > cat f.sql Create Or Replace Function fragments(character varying) Returns setof character varying As $$ Create Temporary Table fragset (smiles character

Re: [SQL]

2006-08-10 Thread Niklas Johansson
On 4 aug 2006, at 08.55, Jonathan Sinclair wrote: SELECT field1, SUM(field2) as Field2, SUM(field3) FROM table1 tb1, table2 tb2 WHERE tb1.field5 BETWEEN '03/07/2006' AND '03/08/2006' AND tb1.field6 = tb2.field7 AND tb1.field8 = tb2.field8 AND tb2.field9 BETWEEN 50.00 AND 150.00 GROUP BY field1 H

[SQL] Breaking up a query

2006-08-10 Thread Saad Anis
Hi Guys, A fellow at work has written the SQL below to retrieve some data from multiple tables. Obviously it is inefficient and unnecessarily complex, and I am trying to break it into 2 or more queries so as to enhance performance. Can you please help me do so? I would appreciate any help you can

Re: [SQL] how do I check for lower case

2006-08-10 Thread Oisin Glynn
Juliann Meyer wrote: I have a table with a column, lets call it identifier, that is defined as varchar(8) that should never contain lower case letters. Its a large table. Is there a way to query the table to see if any values in this column are lower case and to get a list out? The user int

Re: [SQL] how do I check for lower case

2006-08-10 Thread Scott Marlowe
On Thu, 2006-08-10 at 15:32, Juliann Meyer wrote: > I have a table with a column, lets call it identifier, that is defined > as varchar(8) that should never contain lower case letters. Its a large > table. Is there a way to query the table to see if any values in this > column are lower case a

Re: [SQL] how do I check for lower case

2006-08-10 Thread Daryl Richter
On 8/10/06 4:32 PM, "Juliann Meyer" <[EMAIL PROTECTED]> wrote: > I have a table with a column, lets call it identifier, that is defined > as varchar(8) that should never contain lower case letters. Its a large > table. Is there a way to query the table to see if any values in this > column are l

Re: [SQL] how do I check for lower case

2006-08-10 Thread Rodrigo De León
On 8/10/06, Juliann Meyer <[EMAIL PROTECTED]> wrote: I have a table with a column, lets call it identifier, that is defined as varchar(8) that should never contain lower case letters. Its a large table. Is there a way to query the table to see if any values in this column are lower case and to

[SQL] how do I check for lower case

2006-08-10 Thread Juliann Meyer
I have a table with a column, lets call it identifier, that is defined as varchar(8) that should never contain lower case letters. Its a large table. Is there a way to query the table to see if any values in this column are lower case and to get a list out? The user interface application tha

Re: [SQL] Change of data type

2006-08-10 Thread Shoaib Mir
You can do the following:ALTER TABLE table-name ALTER colum-name TYPE text;Thanks,-- Shoaib MirEnterpriseDB (www.enterprisedb.com) On 8/8/06, Kumar Dev <[EMAIL PROTECTED]> wrote: Use Alter table notebook from control center right click on the table and open alter table notebook you can drop a colum

Re: [SQL] Querying constraints?

2006-08-10 Thread Chris Mair
> Curiously enough, I just answered a similar question on the pgsql-admin > list. Try this: > > SELECT c.relname as table, r.conname as contraint_name, r.contype as > contraint_type, pg_catalog.pg_get_constraintdef(r.oid, true) as > constraint_definition FROM pg_catalog.pg_constraint r, > pg_cata

Re: [SQL] Querying constraints?

2006-08-10 Thread Chris Mair
> Is is possible to query from my application whether there is a primary > key or unique constraint on a given table and field name(s)? Curiously enough, I just answered a similar question on the pgsql-admin list. Try this: SELECT c.relname as table, r.conname as contraint_name, r.contype as co

Re: [SQL] date arithmetic

2006-08-10 Thread Osvaldo Rosario Kussama
chrisj escreveu: Hi ALL, I want to do date arithmetic in SQL with a column that is integer. example create table bob ( col1 timestamp , col2 int4 ; where col2 represents a number of minutes. I want to do something like select col1 + interval col2 minutes from bob This is doable wi

[SQL] date arithmetic

2006-08-10 Thread chrisj
Hi ALL, I want to do date arithmetic in SQL with a column that is integer. example create table bob ( col1 timestamp , col2 int4 ; where col2 represents a number of minutes. I want to do something like select col1 + interval col2 minutes from bob This is doable with most other RDBM

Re: [SQL] Change of data type

2006-08-10 Thread Kumar Dev
Use Alter table notebook from control center right click on the table and open alter table notebook you can drop a column or add a column or change the datatype   Kumar  On 8/7/06, Judith <[EMAIL PROTECTED]> wrote:    Hello everybody, excuse me how can I change de data type of a field,I currently h

[SQL] Querying constraints?

2006-08-10 Thread Lexington Luthor
Hi, Is is possible to query from my application whether there is a primary key or unique constraint on a given table and field name(s)? Thanks LL ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archive

[SQL] to_dec()

2006-08-10 Thread Melvin Davidson
Title: to_dec() I have created a to_dec() function, which is in essence, the opposite of the to_hex() function. Does anybody know how I can submit this function to Postgresql ?

[SQL] select query optimization

2006-08-10 Thread sergey
Hi all! i run this query select f1,f2 from t1,t2 where t1.url_id=t2.entry_id and (t1.entry_stamp::date>=(now()::date-interval '14 days')) and the problem is that t1 is a very big table so the query is too slow. what if i move the second condition to where-clause. Can this reduce the select

[SQL]

2006-08-10 Thread Jonathan Sinclair
I'm currently handling a migration from an Informix system to both mySQL and Postgres (same data in each). Having uploaded the DB's into both systems, from Informix, I am having some problems carrying out a query. The query, which I believe, is in standard SQL is as follows: SELECT field1, SUM(fi

Re: [SQL] timestamp (MS SQLServer's rowversion) functionality

2006-08-10 Thread Andrew Hammond
Tomski wrote: > Hello! > As many of you know, SQL Server (2000) has peculiar data type "timestamp" > which is not SQL standard timestamp. In fact it is "rowversion" type. It > makes tha field to be updated with current timestamp when row is updated or > inserted. > Is there any similiar functionali

Re: [SQL] Function Temp Table Woes

2006-08-10 Thread Chad Voelker
Michael- Nice explaination of what was happening to the temp table. Thank you. -Chad --- Michael Fuhr <[EMAIL PROTECTED]> wrote: > On Tue, Aug 08, 2006 at 10:24:02AM -0700, Chad > Voelker wrote: > > The Goal: Return a set of records from one table > based > > on entries in a temporary table. I