Re: [SQL] PL/pgSQL function syntax question?

2008-09-08 Thread imad
I see v_dt is not initialized before comparison, there should be some value in it before it is useful. --Imad On Tue, Sep 9, 2008 at 8:47 AM, Adrian Klaver <[EMAIL PROTECTED]> wrote: > > -- Original message -- > From: "Ruben Gouveia"

Re: [SQL] slow query - only uses indices

2007-12-24 Thread imad
ter: ((boolcol1 IS TRUE) AND (boolcol2" IS FALSE))" > -> Index Scan using tablee_atextfield_idx on tablee m > (cost=0.00..14.28 rows=1 width=39) (actual time=0.883..0.883 rows=0 > loops=228) > Index Cond: (u.atextfield = m.atextfield) > > >

Re: [SQL] Concatenation through SQL

2007-12-21 Thread imad
t; pgslekt=> select array_to_string(array(select given, patronym, toponym > from persons where person_id=57), ' '); > ERROR: subquery must return only one column Try concatenating your columns using the '||' operator or 'concat' function and project only

Re: [SQL] PL/PGSQL Record type question

2007-05-11 Thread imad
ror. Yeah ... valid point. e.g. As Imad gives in his example ... CREATE FUNCTION xyz() RETURNS record AS $$ declare abc RECORD; begin abc := (1, 2); return abc; end; $$ language plpgsql; And execute the function in this fashion: select a, b from xyz() as (a int, b int); The only p

Re: [SQL] PL/PGSQL Record type question

2007-05-11 Thread imad
create a function with return type as a RECORD. CREATE FUNCTION xyz() RETURNS record AS $$ declare abc RECORD; begin abc := (1, 2); return abc; end; $$ language plpgsql; And execute the function in this fashion: select a, b from xyz() as (a int, b int); Do you like that ... :-) --Imad

Re: [SQL] PL/PGSQL Record type question

2007-05-11 Thread imad
You might be looking for PostgreSQL RECORD data type. --Imad www.EnterpriseDB.com On 5/11/07, Gábriel Ákos <[EMAIL PROTECTED]> wrote: Hi, How should I define a record type (there is no table with this record type) programmatically in pl/pgsql? I'd like to return a record wi

Re: [SQL] Log, Logs and more Logs

2007-01-31 Thread imad
Change it in the postgresql.conf file only if you want to make it permanent. Otherwise just set the variable for your current session without a server restart. --Imad www.EnterpriseDB.com On 1/31/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: It was commented. Thank you Shoa

Re: [SQL] Grants

2006-11-30 Thread imad
You did not grant access privileges to schema. Also GRANT administrators on the base schema as you did for the table. --Imad www.EnterpriseDB.com On 12/1/06, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: Hi list, I am having problem with grants and users on PostgreSQL. I am

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread imad
Check this one http://archives.postgresql.org/pgsql-patches/2004-04/msg00280.php I have not personally worked on what is described in this page but someone will correct you in the community if anything is going wrong here. --Imad www.EnterpriseDB.com On 11/19/06, Rajesh Kumar Mallah <[EM

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread imad
Why dont you try to make 'username' part of your query. While auditing updates and inserts, the username can be some how made a part of the tuple being inserted. Just a thought! --Imad www.EnterpriseDB.com On 11/18/06, Rajesh Kumar Mallah <[EMAIL PROTECTED]> wrote: Hi , Is

Re: [SQL] Another question about composite types

2006-11-13 Thread imad
. --Imad www.EnterpriseDB.com On 11/14/06, Rodrigo Sakai <[EMAIL PROTECTED]> wrote: I know that if I create a table salary that references my employee table works! But I'm trying to work with the composite type concept! Thinking in Object-Oriented Programming (OOP) I have a class em

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread imad
max (timestamptz, timestamptz) does not exist already. You need to create a simple function in PLpgSQL something like if a > b return a; else return b; Even an sql function will do the job here using case statement. --Imad www.EntepriseDB.com On 11/13/06, A. Kretschmer <[EMAIL PRO

Re: [SQL] Inserting data in composite types!

2006-11-13 Thread imad
I am able to do this thing with the following query: insert into employee (a, name, s) values(1, 'emp name', ((1, '(01/01/2000, 01/01/2000)'))); --Imad www.EnterpriseDB.com On 11/13/06, Rodrigo Sakai <[EMAIL PROTECTED]> wrote: Hi, I have a question a

Re: [SQL] Distribution of results

2006-11-06 Thread imad
What else do you want to know about it? (keeping in mind the example you gave) Because, apparently this is just a matter of min and max. --Imad On 11/1/06, Raghuraman K <[EMAIL PROTECTED]> wrote: Hi,      I have a table like this: create table(xyz char(10), answer number(4)).  There are a

Re: [SQL] Composite Types

2006-11-06 Thread imad
This is *not* a good practice to handle elements of a composite data type seperately because they all build it up together and without one of it, the data type is meaningless. Secondly, If you are going to base our application on this principle, you better rethink your design. --Imad

Re: [SQL] Nested select

2006-11-06 Thread imad
Can you write the error message here? --Imad www.EnterpriseDB.com On 11/6/06, Hubert Retif <[EMAIL PROTECTED]> wrote: Hi, I am migrating my application from MySQL to Postgresql and have met following situation: SELECT (sum(sold_price)/(select sum(sold_price) from car_archive

Re: [SQL] Create Function (SQL)

2006-11-05 Thread imad
You can return a record: create function thing(text) returns record as 'select * from whatever where id=$1' language sql; Hope this helps. --Imad www.EnterpriseDB.com On 11/5/06, Mark Simon <[EMAIL PROTECTED]> wrote: I am trying to create a simple function using SQL rathe

Re: [SQL] Long SQL Update Question

2006-11-04 Thread imad
PostgreSQL. Get it from pgFoundry. --Imad www.EnterpriseDB.com On 11/4/06, Dylan Lorimer <[EMAIL PROTECTED]> wrote: So I kicked off a SQL transaction that has been running for 30+ minutes. Is there any way to monitor it to know if it has possibly hanged or not? To be fair, it is an updat

Re: [SQL] Index + View Question

2006-11-03 Thread imad
When you select from views, you are infact selecting from the underlying tables. Indexes created on those tables are used ultimately. --Imad www.EnterpriseDB.com On 11/4/06, Dylan Lorimer <[EMAIL PROTECTED]> wrote: Hi, If I've got several tables, each with their own indexes. I

Re: [SQL] [GENERAL] Is there anyway to...

2006-11-02 Thread imad
Yeah, and EnterpriseDB Management Server is a community project and can be used for free, off course! --Imad www.EnterpriseDB.com On 11/3/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am Fri, dem 03.11.2006, um 0:04:50 +0500 mailte imad folgendes: > Or you can probably use a P

Re: [SQL] [GENERAL] Is there anyway to...

2006-11-02 Thread imad
Or you can probably use a PostgreSQL administration tool for scheduled jobs. I know a number of such tools which provide this feature and EnterpriseDB Management Server is one of them. --Imad www.EnterpriseDB.com On 11/2/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am Thu, dem 02.11.20

[SQL] Executing Anonymous Blocks

2005-04-02 Thread imad
hi, I want to know is there any way to execute an anonymous PL/pgSQL block in PostgreSQL. Thanx -- Regards Imad ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings