Re: [SQL] new user on mac

2011-10-18 Thread Vibhor Kumar
(pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > > > psql + editor is the basic tool set, certainly the most flexible. > Also be sure to check out pgadmin: http://www.pgadmin.org/download/macosx.php +1 for pgAdmi

Re: [SQL] How to realize ROW_NUMBER() in 8.3?

2011-04-20 Thread Vibhor Kumar
om/index.php/2007/08/17/rownum-anyone-cumulative-sum-in-one-query/ Thanks & Regards, Vibhor Kumar EnterpriseDB Corporation The Enterprise PostgreSQL Company vibhor.ku...@enterprisedb.com Blog:http://vibhork.blogspot.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] converting big int to date

2011-03-24 Thread Vibhor Kumar
On Mar 24, 2011, at 2:42 AM, Sree wrote: > How can i convert bigint to date format. > > bigint=6169625280 Please explain what;s this value shows. Thanks & Regards, Vibhor Kumar EnterpriseDB Corporation The Enterprise PostgreSQL Company vibhor.ku...@enterprisedb.

Re: [SQL] what's wrong in this procedure?

2011-02-28 Thread Vibhor Kumar
a_fim, sum(t.num_itens * t.valor) AS total, count(t.*) AS transacoes FROM ofertas o JOIN transacao t ON o.ofertas_id = t.ofertas_id JOIN municipio m ON o.municipio_id = m.municipio_id WHERE o.data_fim <= now() AND t.status IN('Aguardando Pagto', 'Em análise', &#

Re: [SQL] Problem with serial counters

2011-02-25 Thread Vibhor Kumar
On Feb 25, 2011, at 2:39 AM, Jacques Lebrun wrote: > What can I do to force PostGres to update the internat serial counter when I > do an insert with a specified value for the serial? > After inserting the all the Data, use ALTER SEQUENCE Command: http://www.postgresql.org/docs/8.4/static/sql-

Re: [SQL] Compare two Data bases Structure

2011-02-24 Thread Vibhor Kumar
On Feb 24, 2011, at 5:33 AM, manuel antonio ochoa wrote: > How Can I do to compare two structures of data bases ? > > DBA != DBB I need wich functions and wich tables are not equals > > thnks You can try with apgdiff. http://apgdiff.startnet.biz/ Thanks & Regards, Vibhor -- Sent via pgs

Re: [SQL] TABLE PARTITION

2011-02-06 Thread Vibhor Kumar
On Feb 1, 2011, at 10:31 PM, NEVIN ALEX wrote: > Hi, > I am Nevin Alex and I am using postgresql database for a year . But I > have’nt used table partitions: Please help me to do it in a better way. I got > it from the documentation that it is an inheritance capability and the > Trigger

[SQL] Issue while using PostgreSql 8.4.

2010-12-23 Thread Atul Kumar
to delete that table . I am observing application is getting hang while executing statement.execute(). Please suggest me how to fix this issue. Thanks Atul Kumar DISCLAIMER == This e-mail may contain privileged and confidential information which is the property of Persistent Systems L

Re: [SQL] pgdump with insert command help

2010-09-27 Thread Vibhor Kumar
On Sep 24, 2010, at 6:02 PM, Nicholas I wrote: > > pg_dump -Dt --insert table dbname > table.sql; > > i am not able to get the output. is this correct ? Try following: pg_dump --insert -t Thanks & Regards, Vibhor Kumar EnterpriseDB Corporation -- Sent via pgsql-sql

Re: [SQL] Question about domains.

2010-07-08 Thread Vibhor Kumar
e cast (idtype as idtype1) with function idtype2int(idtype) as implicit; Then execute the alter table command to convert the data type: alter table mytab alter column id type idtype1; -- Thanks& Regards, Vibhor Kumar. EnterpriseDB Corporation The Enterprise Postgres Company -- Sent via pg

[SQL] schema proxying virtual database

2009-09-13 Thread Rajesh Kumar Mallah
[ sorry if it is a repost, i am not sure if i am subscribed in -general ] Dear List, There are many opensource applications that support postgresql (eg , gforge , bricolage , dspam ..) but does not use schemas(namespaces) as a result of which you are forced to use/create a new database and loose

Re: [SQL] Must I use DISTINCT?

2009-02-05 Thread Rajesh Kumar Mallah
have you tried Join using , eg SELECT e.eid, e.name FROM entry e join access a ON( e.eid = 120 AND (e.ownid = 66 OR e.aid = a.aid) ) ; some sample data might also help in understanding the prob more clrearly. regds rajesh kumar mallah. On Fri, Feb 6, 2009 at 3:27 AM, Michael B Allen

Re: [SQL] (possible) bug with constraint exclusion

2008-01-12 Thread Rajesh Kumar Mallah
On Jan 12, 2008 10:54 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > > Am I correct in understanding that the current behavior is inappropriate > > and shall be corrected at some point of time in future versions ?

Re: [SQL] (possible) bug with constraint exclusion

2008-01-11 Thread Rajesh Kumar Mallah
On Jan 12, 2008 1:26 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > > looks like constraint exclusion is being too aggressive in excluding null > > values > > Hmm, you're right. Looks like I broke

Re: [SQL] (possible) bug with constraint exclusion

2008-01-10 Thread Rajesh Kumar Mallah
Update the phenomenon does not exists in 8.2.0 but exists in 8.2.5. On Jan 11, 2008 12:28 PM, Rajesh Kumar Mallah <[EMAIL PROTECTED]> wrote: > Hi , > > looks like constraint exclusion is being too aggressive in excluding null > values > although its well known that check

[SQL] (possible) bug with constraint exclusion

2008-01-10 Thread Rajesh Kumar Mallah
Hi , looks like constraint exclusion is being too aggressive in excluding null values although its well known that check constraints apply on not null values only. Hope the minimal test session below explains the problem we facing. BTW: we are very impressed with the performance gains we achieved

Re: [SQL] sql query question ?

2007-12-31 Thread Trilok Kumar
--- Shane Ambler <[EMAIL PROTECTED]> wrote: > Trilok Kumar wrote: > > Hi All, > > > > I have a table called > > > > vehicle_duty_cycle_summary > > > > > > vehicle_master_id | starting_odometer | > > ending_o

[SQL] sql query question ?

2007-12-29 Thread Trilok Kumar
Hi All, I have a table called vehicle_duty_cycle_summary vehicle_master_id | starting_odometer | ending_odometer | login_time | logout_time ---+---+-++ 4 |

Re: [SQL] Track query status

2007-03-29 Thread Rajesh Kumar Mallah
more methods: 1. select * from pg_stat_activity; see what all running and pid of your current query also. 2. SELECT h.pid AS blocker, w.pid AS blockee FROM ONLY pg_locks h, ONLY pg_locks w WHERE h."granted" AND NOT w."granted" AND (h.relation = w.relation AND h."database" = w."database" OR h.

Re: [SQL] Empty Table

2007-03-29 Thread Rajesh Kumar Mallah
>I dont think i clearly understand your requirement. > >Are you wanting to restore the "PLAIN" backup of a database >with a different database name ? > Yes Are you getting any particular error? what platform are you in ? >what do you mean "deleting information of current database ..." > Clear

Re: [SQL] Empty Table

2007-03-29 Thread Rajesh Kumar Mallah
se (the database I used to make the backup). I think that's why pgAdmin does not work with plain backups on Restore. What does occurs with the information schema when I restore from one database with a name to other with another name ? Regards Ezequias Em Thu, 29 Mar 2007 23:46:31 +0530

Re: [SQL] Empty Table

2007-03-29 Thread Rajesh Kumar Mallah
psql> TRUNCATE TABLE ; if you have too many tables , generate the above commands by using a query on tables information schema table. hope it helps. On 3/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi list, I have many tables with many constraints and I would like to empty all my table

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Rajesh Kumar Mallah
L PROTECTED]> wrote: > > Thanks Buddy, really appreciate ur help on this > > problem solved... > > Is there any way this query can be optimized...i'm running it on a huge > table with joins > > - Sumeet > > > On 2/23/07, Rajesh Kumar Mallah <[E

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Rajesh Kumar Mallah
On 2/24/07, Sumeet <[EMAIL PROTECTED]> wrote: Hi all, I'm trying to write a query to select random values from a set of 'GROUP BY' see the scenario below to understand the problem here (the actual problem cannot be discussed here so i'm taking an example scenario) Assume there is a table

[SQL] ordering of selected rows from an ordered subselect

2007-02-17 Thread Rajesh Kumar Mallah
Hi, we know that rows in a table are not stored in any particular order and explicit order by clause is required to get data in any particular order. but does it apply to select queries from ordered subselects also ? eg select id , name , expensive_func(name) from ( select id , name f

Re: [SQL] subquery abnormal behavior

2006-12-10 Thread Rajesh Kumar Mallah
On 12/11/06, Shoaib Mir <[EMAIL PROTECTED]> wrote: I just noticed an abnormal behavior for the subquery: create table myt1 (a numeric); create table myt2 (b numeric); select a from myt1 where a in (select a from myt2); This should be giving an error that column 'a' does not exist in myt2 b

Re: [SQL] Proper way of iterating over the column names in a trigger function. [ SOLVED]

2006-12-06 Thread Rajesh Kumar Mallah
On 12/6/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > what is the proper way for iterating over column names of a table using > SPI_* functions. You need to pay attention to the attisdropped field of the TupleDesc entri

[SQL] Proper way of iterating over the column names in a trigger function.

2006-12-06 Thread Rajesh Kumar Mallah
Hi, I am trying to interate over column names of a table on which a C trigger function is called on UPDATE/DELETE and INSERT. SPI function char * SPI_fname(TupleDesc rowdesc, int colnumber) is being used. looks like the function is returning column names like "pg.dropped.2" for d

Re: [SQL] calling elog possibly causing problem in DirectFunctionCall1

2006-12-01 Thread Rajesh Kumar Mallah
On 12/1/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > data->time_stamp = > DirectFunctionCall1(timestamptz_in, CStringGetDatum("now")); This code is incorrect, as timestamptz_in takes three argument

Re: [SQL] calling elog possibly causing problem in DirectFunctionCall1

2006-12-01 Thread Rajesh Kumar Mallah
On 12/1/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > data->time_stamp = > DirectFunctionCall1(timestamptz_in, CStringGetDatum("now")); This code is incorrect, as timestamptz_in takes three arguments

[SQL] calling elog possibly causing problem in DirectFunctionCall1

2006-12-01 Thread Rajesh Kumar Mallah
Hi , In certain C trigger function following code snippet causes ERROR: --- elog (NOTICE , "before calling DirectFunctionCall1"); data->time_stamp = DirectFunctionCall1(timestamptz_in, CStringGetDatum("now")); elog (NOTICE , "after calling Direct

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
On 11/19/06, Tom Lane <[EMAIL PROTECTED]> wrote: "Rajesh Kumar Mallah" <[EMAIL PROTECTED]> writes: > In our webapps, we use the same username to connect to the database > for all kind of updates. Hence we are not able to makeout whoo modified > what . Howev

Re: [SQL] Random()

2006-11-18 Thread Rajesh Kumar Mallah
On 11/18/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am Sat, dem 18.11.2006, um 23:02:33 +0530 mailte Rajesh Kumar Mallah folgendes: > >select from order by random() limit 1; > > This query will tend to get slower as the table grows because of the > sorting. Right. &

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
On 11/18/06, Volkan YAZICI <[EMAIL PROTECTED]> wrote: Hi, On Nov 18 06:00, Rajesh Kumar Mallah wrote: > Is there any way to set a variable from a web application (using > dbi/perl , libpq etc), and access the same variable from a C trigger > inside a transaction ? Why don't

Re: [SQL] Random()

2006-11-18 Thread Rajesh Kumar Mallah
On 11/17/06, A. Kretschmer <[EMAIL PROTECTED]> wrote: am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da Rocha folgendes: > Hi list, > > I have a bigint collumn and I would like to generate a random number within the > numbers of my column. select from order by random()

Re: [SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
hi, We do not want to modify our apps for doing auditing. we are considering table level auditing auditrail http://gborg.postgresql.org/project/audittrail/projdisplay.php seems to be doing a good job. i just need to access the "username" that starts the transaction in webapp from the trigger in a

[SQL] transactional shared variable in postgresql

2006-11-18 Thread Rajesh Kumar Mallah
Hi , Is there any way to set a variable from a web application (using dbi/perl , libpq etc), and access the same variable from a C trigger inside a transaction ? the %_SHARED hash available in plperl provides only session level isolation and does not suit the requirement. Original problem: we

[SQL] Can we convert from Postgres to Oracle !!???

2006-10-20 Thread Sandeep Kumar Jakkaraju
Can we convert from Postgres to Oracle !!??? ---(end of broadcast)--- TIP 1: 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

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 cur

[SQL] User Permission

2006-07-19 Thread sathish kumar shanmugavelu
Dear group,   i created a user named 'dataviewer' and grant only select permission to that user,   but now the user could able to create tables. how to restrict this,   i want to give permission to create views and do selects on tables and views.    how to do it?   plz help.-- Sathish Kumar.SSpireT

Re: [SQL] concurrency problem

2006-06-16 Thread sathish kumar shanmugavelu
Dear group    Its my mistake that i did not reveal the whole scenario.   Actually  within that  begin  and  commit, i insert in 10 tables. The above said table is the key table.   I fetch the consultatioin_no and add one to it, i should know this consultation_no to save the other 10 tables. because

[SQL] concurrency problem

2006-06-16 Thread sathish kumar shanmugavelu
faced the problem, then we run in three system the record is saved, after that we simulate the run once again, we face the problem,    i could not predict the problem precisely - what might be the problem. thanks in advance- Show quoted text -  On 6/16/06, Richard Huxton <dev@archonet.c

[SQL] concurrency problem

2006-06-15 Thread sathish kumar shanmugavelu
Dear group,    Let me explain my issue.   We use              Database  - postgresql-8.1  JDBC Driver  - postgresql-8.1-407.jdbc3.jar  Java - jdk1.5              The default transaction isolation level is - Read Committed   Auto Commit is fals

Re: [SQL] converting epoch to timestamp

2005-10-27 Thread Rajesh Kumar Mallah
On 10/26/05, Richard Huxton wrote: > Rajesh Kumar Mallah wrote: > > Hi, > > > > Can anyone tell me how to convert epoch to timestamp ? > > > > ie reverse of : > > > > SELECT EXTRACT( epoch FROM now() ); > > I'd start with either Googl

[SQL] converting epoch to timestamp

2005-10-26 Thread Rajesh Kumar Mallah
Hi, Can anyone tell me how to convert epoch to timestamp ? ie reverse of : SELECT EXTRACT( epoch FROM now() ); +--+ |date_part | +--+ | 1130317518.61997 | +--+ (1 row) Regds mallah. ---(end of broadcast)--

Re: [SQL] Issue with UPDATE statement on v8

2005-09-22 Thread Rajesh Kumar Mallah
On 9/23/05, Kenneth Hutchinson <[EMAIL PROTECTED]> wrote: > Hello, > > I'm sorry if this has been sent to the community multiple times. I am > not able to determine whether my posts have gotten through. If you have > rec'd this multiple times, please let me know. > > We have recently migrated to

Re: [SQL] Help with a view

2005-09-22 Thread Rajesh Kumar Mallah
> Basically, what I've got is the first person and the tag_type. I can do > it with a function from PHP: > > function get_spouses($p) { > $handle = pg_query("select person from principals >where event in (select event from principals >where person

Re: [SQL] partial index on non default tablespace syntax

2005-06-18 Thread Rajesh Kumar Mallah
Fuhr,Tom and Everyone Extremely sorry for not consulting the docs. I was doing this: CREATE INDEX foo_name_idx ON foo (name) WHERE name IS NOT NULL TABLESPACE testspace ; Regds Rajesh Kumar Mallah. On 6/18/05, Michael Fuhr <[EMAIL PROTECTED]> wrote: > On Sat, Jun 18, 2005 at 10:24:0

[SQL] partial index on non default tablespace syntax

2005-06-18 Thread Rajesh Kumar Mallah
the TODO Regds Rajesh Kumar Mallah. ---(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

Re: [SQL] plpgsql dynamic record access

2005-06-08 Thread Rajesh Kumar Mallah
Ganesh, Did you have a look at example Example 35-2. A PL/pgSQL http://www.postgresql.org/docs/current/static/plpgsql-trigger.html Regds maLLAH ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Tsearch2 headline usage

2005-06-04 Thread Rajesh Kumar Mallah
Hi There, We are using tsearch2 for FTS implementation. For highlighting the search term in the result we are displaying the output of headline function which is supposed to tag (mark up) those stemmed words in the text that match any of the stemmed words in search term. The problem is that some

[SQL] How to configure postgresql to accept TCP/IP connections

2005-04-22 Thread amit kumar awasthi
  Hello sir actually i am working with Qt using postgresql i have to get connection {(database("trainee"),user("trainee"))} from the network (database remote accessing) so i have configured postgresql.conf and pg_hba.conf upto some extents the fields that i  have configured r as follows even

[SQL] Unable to execute Java Progarm

2004-12-24 Thread Anil Kumar
Connection(DriverManager.java:517)    at java.sql.DriverManager.getConnection(DriverManager.java:177)    at NotificationTest.main(NotificationTest.java:13)Pl give me the solution for this problem Waiting eagerly for ur reply   Regards Anil Kumar.S BEGIN:VCARD VERSION:2.1 N:Kumar;Anil FN:Anil K

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
aesemann grzm myrealbox com !DSPAM:4134745e87571738116768! -- regds Mallah. Rajesh Kumar Mallah +---+ | Tradeindia.com (3,11,246) Registered Users | | Indias' Leading B2B eMarketPlace

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Michael Glaesemann wrote: On Aug 31, 2004, at 8:55 PM, Rajesh Kumar Mallah wrote: The docs says that numeric type supports numbers upto any precision However tradein_clients=# SELECT cast(2^100 as numeric); 1. Does the specs not require pgsql to print a warning or info , will it not be

[SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
any way to do such calculation using pgsql, i understand bc is a better tool for it. Warm Regards Rajesh Kumar Mallah. -- regds Mallah. Rajesh Kumar Mallah +---+ | Tradeindia.com (3,11,246) Registered Users | | Indias' Leading B2B eMarket

Re: [SQL] Comparing tsearch2 vectors.

2004-07-12 Thread Rajesh Kumar Mallah
Achilleus Mantzios wrote: O kyrios Rajesh Kumar Mallah egrapse stis Jul 12, 2004 : Achilleus Mantzios wrote: O kyrios Rajesh Kumar Mallah egrapse stis Jul 12, 2004 : Dear Mantzios, I have to get set of banners from database in response to a search term. I want that the search term

Re: [SQL] Secure DB Systems - How to

2004-07-12 Thread Rajesh Kumar Mallah
---(end of broadcast)--- TIP 8: explain analyze is your friend -- regds Mallah. Rajesh Kumar Mallah +---+ | Tradeindia.com (3,11,246) Registered Users | | Indias' Leading B2B eMarketPlace | |

Re: [SQL] Comparing tsearch2 vectors.

2004-07-12 Thread Rajesh Kumar Mallah
Achilleus Mantzios wrote: O kyrios Rajesh Kumar Mallah egrapse stis Jul 12, 2004 : Dear Mantzios, I have to get set of banners from database in response to a search term. I want that the search term be compared to the keyword corresponding to the banners stored in database. current i am doing

Re: [SQL] Comparing tsearch2 vectors.

2004-07-12 Thread Rajesh Kumar Mallah
and keywords). So that the banners for the adword say 'incense exporter' is shown even if 'incenses exporter' or 'incense exporters' is searched. I hope i am able to clarify. Regds Mallah. Achilleus Mantzios wrote: O kyrios Rajesh Kumar Mallah egrapse stis Jul 12, 20

[SQL] Comparing tsearch2 vectors.

2004-07-12 Thread Rajesh Kumar Mallah
rator matches the given name and argument type(s). You may need to add explicit type casts. tradein_clients=# -- regds Mallah. Rajesh Kumar Mallah +---+ | Tradeindia.com (3,11,246) Registered Users | |

Re: [SQL] Problem in Stored Procedures

2004-07-10 Thread Rajesh Kumar Mallah
ear "AS" (for CREATE TYPE command) psql:Procedures.sql:40: NOTICE: return type 'pointtype' is only a shell CREATE WHEN I EXECUTE THE FUNCTION USING SELECT (pp_readparameter(42,null)); ERROR: fmgr_info: function 0: cache lookup failed. any value inputs on why this is happening.

Re: [SQL] Query becoming slower on adding a primary key [ SOLVED

2004-06-10 Thread Rajesh Kumar Mallah
HI, The problem was solved by reducing the effective_cache_size from 102400 to 10240 my total RAM is 4GB. Regds mallah. Tom Lane wrote: [EMAIL PROTECTED] writes: tradein_clients=# explain analyze select email_id ,email ,contact from t_a a join email_source f using(email_id) j

Re: [SQL] Query becoming slower on adding a primary key

2004-06-08 Thread Rajesh Kumar Mallah
Hi, Is there any solution to this issue ? I am facing it every week. Warm Regds Mallah. Rajesh Kumar Mallah wrote: Tom Lane wrote: [EMAIL PROTECTED] writes: tradein_clients=# explain analyze select email_id ,email ,contact from t_a a join email_source f using(email_id) join email_subscriptions

[SQL] Last day of month

2004-06-07 Thread Kumar
Dear friends,   Postgres 7.3.4   How to find the last sunday/mon/sat of any given month.   Thanks Kumar

Re: [SQL] Query becoming slower on adding a primary key

2004-06-02 Thread Rajesh Kumar Mallah
Even the first query used to run fine before but one fine day it changed plans i think. Regds Mallah. Rajesh Kumar Mallah wrote: Tom Lane wrote: [EMAIL PROTECTED] writes: tradein_clients=# explain analyze select email_id ,email ,contact from t_a a join email_source f using(email_id) join

Re: [SQL] assistance on self join pls

2004-06-02 Thread Rajesh Kumar Mallah
Dear Darren, Your question is not very clear to me. On what columns do you want to aggregate? suppose u want to aggregate on outsite and inside ip you shud group by those columns and run a aggregate function like sum or avg etc , suppose u want the total traffic for every pair you can do this: sele

Re: [SQL] Query becoming slower on adding a primary key

2004-06-02 Thread Rajesh Kumar Mallah
Tom Lane wrote: [EMAIL PROTECTED] writes: tradein_clients=# explain analyze select email_id ,email ,contact from t_a a join email_source f using(email_id) join email_subscriptions h using(email_id) where 1=1 and f.source_id =1 and h.sub_id = 3 ; Runs for Eve

[SQL] Opening and Fetching from a refcursor inside a function

2004-05-18 Thread kumar
follows.   fn_xyz(refcursor,int4) returns recordDeclaredata ALIAS $1;mview RECORD;FOR mview IN FETCH ALL IN dataLOOP//Process the records.END LOOP;   Is this possible. Please shed some light.   Thanks Kumar

Re: [SQL] Problem in SQL Trigger

2004-04-30 Thread Rajesh Kumar Mallah
Can you tell us about the postgresql versions in 7.3 and 9.0 also post the actuall error message from postgresql. regds mallah. Ramesh Patel wrote: Hi i have one problem in Trigger. this trigger alread work on Red Hat Linux 7.3 but now i shift to RHL9.0 in RHL 9.0 not working . in this problem in

[SQL] Equivalant of SQL Server's Nchar and NVARCHAR

2004-04-29 Thread kumar
Dear friends, Is there any equivalent datatype of SQL Server's NCHAR and NVARCHAR, available with Postgres 7.3.4. I want to store characters, special characters and Numbers. Please shed some light.   Thanks Kumar

Re: [SQL] Customised Encoding

2004-04-27 Thread kumar
to convert any 16 bit to a single charactor. Is there any function to do that in Postgres. Thanks Kumar - Original Message - From: "Richard Huxton" <[EMAIL PROTECTED]> To: "kumar" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 27, 2004

[SQL] How to get binary value for an Integer

2004-04-27 Thread kumar
Dear Friends,    I am using postgres 7.3.2. I wanna get the binary value of number 65536. Is there anyway to get that postgres functions.   Thanks kumar  

Re: [SQL] Logical comparison on Strings

2004-04-27 Thread Rajesh Kumar Mallah
kumar wrote: Dear Friends, Postgres 7.3.2 on Linux 7. I want to compare to columns and get the logical result as follows. C1 is 'YNYNY' . C2 is 'NNYYY'. I want to compare like AND and OR operators. C1 AND C2 should give result like NNYNY. C1 OR C2 should give res

[SQL] Customised Encoding

2004-04-27 Thread kumar
Dear Friends,   Postgres 7.3.2 Runing on Linux 7.2   I would like to convert any values in between 1 to 2^16 into a single charactor. And decode that single char to get back the numeric value again. Any function to do that in Postgres SQL Server.   Please shed some light.   Thanks Kumar

[SQL] Logical comparison on Strings

2004-04-26 Thread kumar
YNYYY.   Please shed some light.   Thanks Kumar

Re: [SQL] Querying two databases

2004-04-16 Thread Rajesh Kumar Mallah
hi, its not possible to join cross database tables . you may keep tables in different schemas instead of databases. you may also try contrib/dblink to use tables from different database. Regds mallah. Pallav Kalva wrote: Hi, I am new to postgres and I need to do a query which joins two table

[SQL] Grant permission to all objects of user A to user B

2004-04-14 Thread kumar
Dear Friends,   Postgres 7.3.2.   I have an database with owner USRA who owns about 300 objects (tables and functions). Now I want to give 'ALL' permission to all the objects of USRA to another database user USRB.   If I use the grant i need to type all the objects as comma separated, like th

[SQL] Encoding and result string length

2004-04-08 Thread kumar
t a result as     1 YzE=   But this is the encoded value for 'c1' and not for the value 1.   Please shed some light.   Also is it possible to get the encoded values with only 2 charactors, irrespective of the values of c1 ranging from 100 to 10 million   Thanks Kumar  

[SQL] Rename Schema or Script DDL only a schema

2004-04-06 Thread kumar
Dear Friends,   Postgres 7.3.2 on Linux 8.   I wanna move about 100 tables from one schema to another (within a database). Is possible to do that? Seems pg_dump doesnt have an option to script only the schema.   Else, it possible to rename the schema.   Please shed some light.   Thanks Kumar

[SQL] psql: FATAL 1: IDENT authentication failed for user error - Urgent pls

2004-03-19 Thread Kumar
Dear Friends,   I have installed Linux Fedore and wanted to work with the default installed postgres 7.3.4 database.   I could able to create to create user, but while try to connect, I got the following error message psql: FATAL 1: IDENT authentication failed for user   My pg_hba.conf file l

[SQL] Tsearch2 question: getting histogram of the vector elements

2004-03-10 Thread Rajesh Kumar Mallah
Greetings! My original problem is to de duplicate a list of around 0.3 million company names. Since a company name can be potentially (mis)spelt in numerous ways exactmatch obviously wont work. To make the searches faster i am using tsearch. For each company name i want to search other compa

[SQL] Return more than a record

2004-02-26 Thread Kumar
Dear Friends,   Postgres 7.3.4 on RH Linux 7.2.   Get the following from the groupscreate or replace function ExpensiveDepartments() returns setof table1 as ' declare r table1%rowtype; begin for r in select departmentid, sum(salary) as totalsalary from GetEmployees() group by de

Re: [SQL] Return more than a record

2004-02-26 Thread Kumar
return the value of v_activity_start_date for every row in activities table. How could I achieve this. Please shed some light. Thanks Kumar - Original Message - From: "Stephan Szabo" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]> Cc: "psql" &l

[SQL] Disabling constraints

2004-02-17 Thread Kumar
enabling a constraint, as follows. update pg_class set reltriggers=0 where relname = 'crm.activities';update pg_class set reltriggers = count(*) from pg_trigger where pg_class.oid=tgrelid and relname='crm.activities';   Also doesnt work.   Is there a way to do it?   Thanks Kumar

Re: [SQL] Getting the week of a date

2004-02-16 Thread Kumar
I am sorry. I didn't read the doc properly. I understood why it is written in that way. Sorry for the trouble. Thanks. It worked fine for me. Thanks Kumar - Original Message - From: "Kumar" <[EMAIL PROTECTED]> To: "sad" <[EMAIL PROTECTED]>; <[EMAI

Re: [SQL] Getting the week of a date

2004-02-16 Thread Kumar
ason why you have included that? Thanks Kumar - Original Message - From: "sad" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 16, 2004 6:53 PM Subject: Re: [SQL] Getting the week of a date EXCUSE ME, GUYS ! i forgot to add one monome: 7*(

[SQL] Getting the week of a date

2004-02-16 Thread Kumar
x27;,current_date + ('5 month')::INTERVAL);ERROR:  TIMESTAMP units 'week' not supportedtest=#   Any idea on how to find the 3 rd Wednesday of any given month.   Thanks Kumar  

[SQL] writing a dynamic sql

2004-02-15 Thread Senthil Kumar S
Dear friends,I am having an lengthy SQL, which will be called every conditions of if...else statement. I tried with passing that via a string and execute it.But I got error. v_sql :=  'INSERT INTO activities(    activity_id,    parent_activity_id,    activity_type_id,    subject,    descrip

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-13 Thread Kumar
Thanks Tomasz Myrta. It is wonderful. I am still amazed from where you guys knowing the options like quote_literal, etc. Kumar - Original Message - From: "Tomasz Myrta" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]> Cc: "psql" <[EMAIL

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-12 Thread Kumar
tation 'NULL' I think using 'CASE' this could be solved. But instead is there any other simple way to do it. Thanks a lot Mr. Tomasz Myrta Kumar - Original Message - From: "Tomasz Myrta" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]&

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-12 Thread Kumar
Dear all, I solved it using ISNULL function. sqlstr := 'insert into test(c1, c2) values ('||ISNULL(rec.c1,'NULL')||',' > ||'\''||rec.c2||'\')'; Thanks kumar - Original Message - From: "Kumar" <[EMAIL PRO

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-12 Thread Kumar
7;; NOTICE: WARNING: Error occurred while executing PL/pgSQL function test_fn WARNING: line 11 at execute statement ERROR: cannot EXECUTE NULL query That is the problem i am facing. Please shed some light. Thanks Kumar - Original Message - From: "Tomasz Myrta" <[EMAIL PROTEC

[SQL] How to avoid nulls while writing string for dynamic query

2004-02-12 Thread Kumar
e column c1 is a string I might have replace it with empty string. I don't want to substitute with '0' which could work.   sqlstr := 'insert into test(c1, c2) values (' ||ISNULL(rec.c1,'0')||','                                                            ||'\''||rec.c2||'\')';   NOTICE:  insert into test(c1, c2) values (1,'Hai1')NOTICE:  insert into test(c1, c2) values (0,'Hai2')   Total query runtime: 47 ms.Data retrieval runtime: 0 ms.1 rows retrieved.   How can I do that. Please advise me.   Thanks Kumar    

Re: [SQL] Error in declaring %rowtype for recurrence

2004-02-10 Thread Kumar
I am sorry. I didn't get you. Can u pls tell me more Thanks kumar - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]> Cc: "psql" <[EMAIL PROTECTED]> Sent: Tuesday, February 10, 2004 2:02

[SQL] Error in declaring %rowtype for recurrence

2004-02-09 Thread Kumar
--- Note the change hereBEGINFOR rec_recurrence IN SELECT * FROM crm.recurrences LOOPRAISE NOTICE 'Hai';END LOOP;    RETURN 'DONE';END;'  LANGUAGE 'plpgsql' VOLATILE;     Why is that so? Anyone can please clear me.   Regards Kumar

Re: [SQL] SQL Query for Top Down fetching of childs

2004-01-29 Thread Kumar
Thanks a lot Mr.Richard Huxton. It managed to find a similar one and modified to my need. It is working fine. Thanks a lot - Original Message - From: "Richard Huxton" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]>; "psql" <[EMAIL PROTECT

[SQL] SQL Query for Top Down fetching of childs

2004-01-28 Thread Kumar
ATILE;   Anybody pls help me with this. I am first time writing these kind of function for TOP DOWN analysis. Please shed light.   Regards Senthil Kumar S  

Re: [ADMIN] [SQL] Database diagram

2004-01-23 Thread Rajesh Kumar Mallah
Dear Ganesan, pgautodoc (for dot output) + dot (from graphviz.org , creates postscript) + epssplit ( splits the postscript into multipage so that one can create poster size diagrams) works well for me. I have 45 tables in the database though. Regds mallah. Chris Travers wrote: There is a fre

[SQL] array_lower /array_prepend doubt

2004-01-21 Thread Rajesh Kumar Mallah
Greetings! can anyone explain why SELECT array_lower(array_prepend(0, ARRAY[1,2,3]), 1); returns 0 not 1 because tradein_clients=# SELECT array_prepend(0, ARRAY[1,2,3]); +---+ | array_prepend | +---+ | {0,1,2,3} | +---+ (1 row) and tradein_clients=# SE

  1   2   3   >