Re: [SQL] How to Convert Integer to Serial

2010-10-28 Thread Shoaib Mir
On Fri, Oct 29, 2010 at 3:58 PM, venkat wrote: > Dear All, > > I got the solution... Here is my query > > ALTER TABLE DemoTable ALTER gid TYPE INT2; > > > Are you sure that you have converted here to a SERIAL type? -- Shoaib Mir http://shoaibmir.wordpress.com/

Re: [SQL] How to Convert Integer to Serial

2010-10-28 Thread Shoaib Mir
nce for the column (set the start of sequence according to the values you got already in the column) - Now set this sequence as the default value for that specific column which you need to ALTER like this: ALTER TABLE tablename ALTER COLUMN columnname SET DEFAULT nextval('newsequence&

Re: [SQL] Can i force deletion of dependent rows?

2010-02-13 Thread Shoaib Mir
l.org/docs/8.3/interactive/ddl-constraints.html CREATE TABLE order_items ( product_no integer REFERENCES products *ON DELETE RESTRICT*, order_id integer REFERENCES orders *ON DELETE CASCADE*, quantity integer, PRIMARY KEY (product_no, order_id) ); -- Shoaib Mir http://shoaibmir.wordpress.com/

Re: [SQL] mail alert

2009-08-11 Thread Shoaib Mir
possible to alert via mail when some > conditions are true in a database. > > > > I guess you might be able to do that by using PLPython, PLPerl or PLTcl and using the standard functions for doing emails in there. -- Shoaib Mir http://shoaibmir.wordpress.com/

Re: [SQL] Import (.CVS File) to postgreSql

2009-08-10 Thread Shoaib Mir
to my email as its always better posting it to the list. -- Shoaib Mir http://shoaibmir.wordpress.com/

Re: [SQL] Import (.CVS File) to postgreSql

2009-08-10 Thread Shoaib Mir
ase --> http://www.postgresql.org/docs/8.3/static/sql-copy.html -- Shoaib Mir http://shoaibmir.wordpress.com/

Re: [SQL] search path within trigger

2007-06-09 Thread Shoaib Mir
Did you try 'select current_schema' ? -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 6/9/07, chester c young <[EMAIL PROTECTED]> wrote: within a table pl/pgsql trigger, what's the easiest way to see if the schema for the triggered table is th

Re: [SQL] Inserting a path into Database

2007-06-04 Thread Shoaib Mir
If you are on 8.1 you can use double qoutes ( 'C:\\Program Files\\My program' ) on in 8.2 you can use the new "backslash_quote (string)" setting. You can find help on "backslash_quote (string)" at --> http://www.postgresql.org/docs/current/static/runtime-conf

Re: [SQL] Encode

2007-03-19 Thread Shoaib Mir
For that you will need to drop and re-create it with a different encoding -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 3/19/07, Ezequias R. da Rocha <[EMAIL PROTECTED]> wrote: Hi list, It is possible to change the Encode of one database while it is on ? Sincerely Ez

Re: [SQL] Time of executed query

2007-03-06 Thread Shoaib Mir
EXPLAIN ANALYZE does give the query execution time at the end of its output. -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 3/6/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: EXPLAIN ANALYZE Is perfect but i have no idea of how to use it. My resultset is retrieving m

Re: [SQL] Time of executed query

2007-03-06 Thread Shoaib Mir
Did you try EXPLAIN ANALYZE ? --- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 3/6/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: I preffer that the database give me this information. I don't know if it is possible becouse if we retrieve many rows and if we want

Re: [SQL] Duplicate records

2007-02-02 Thread Shoaib Mir
Where do you see the second table in it? I guess here: A = mytable B = (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) So that is all around one table that is 'mytable', where A and B are just the aliases. -- Shoaib Mir

Re: [SQL] Duplicate records

2007-02-02 Thread Shoaib Mir
That has been asked in the past a number of time too, you can look at the following for details --> http://archives.postgresql.org/pgsql-novice/2006-06/msg00093.php -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 2/2/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: Hi

Re: [SQL] Insert into a date field

2007-02-02 Thread Shoaib Mir
Just tried the following way, that might help you: postgres=# create table testing (a date); CREATE TABLE postgres=# insert into testing values (to_date('1963-09-01', '-MM-DD')); INSERT 0 1 postgres=# select * from testing; a 1963-09-01 (1 row) -- Sho

Re: [SQL] Log, Logs and more Logs

2007-01-31 Thread Shoaib Mir
No problemo :) What was the query and the statement for error? that way we might be able to help... - Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/31/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: Great. Now the log is working. Thank you, Thank you, Tha

Re: [SQL] Log, Logs and more Logs

2007-01-31 Thread Shoaib Mir
You need to set it like this: log_destination = 'syslog,stderr' redirect_stderr = on and then restart the server. It should show up the log from then onwards ------- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/31/07, Ezequias Rodrigues da Rocha <[EMAIL PROT

Re: [SQL] Log, Logs and more Logs

2007-01-31 Thread Shoaib Mir
You need to create the folder manually, give the postgres user permission for write on it and then restart the database server. This way you should be able to set the log files in pg_log folder... Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/31/07, Ezequias Rodrigues da

Re: [SQL] Log, Logs and more Logs

2007-01-31 Thread Shoaib Mir
Check for log_directory setting in your postgresql.conf file... - Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/31/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: I noticed today morning that my pg.log doesn't exist in my server. Why it occurs ?

Re: [SQL] Update query by joining multiple tables.

2007-01-17 Thread Shoaib Mir
Might be a view and then a rule attached with that can help you out with doing updates using joins -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/17/07, Andrew Sullivan <[EMAIL PROTECTED]> wrote: On Wed, Jan 17, 2007 at 04:50:18PM +0530, Moiz Kothari wrote:

Re: [SQL] Unable to drop table, error mentions "reltriggers"

2006-12-27 Thread Shoaib Mir
Run the following: update pg_class set reltriggers = count(*) from pg_trigger where pg_class.oid=tgrelid and relname='vm_message'; It should solve the problem ------ Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 12/28/06, Kashmira Patel (kupatel) <[EMAIL PROT

Re: [SQL] subquery abnormal behavior

2006-12-10 Thread Shoaib Mir
Oh that explains a lot... Thank you, - Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 12/11/06, Michael Glaesemann <[EMAIL PROTECTED]> wrote: On Dec 11, 2006, at 15:48 , Shoaib Mir wrote: > create table myt1 (a numeric); > create table myt2 (b numeric); >

Re: [SQL] subquery abnormal behavior

2006-12-10 Thread Shoaib Mir
I just noticed the same behavior in Oracle and SQL Server as well :) Regards, - Shoaib Mir EnterpriseDB (www.enterprisedb.com) 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 m

[SQL] subquery abnormal behavior

2006-12-10 Thread Shoaib Mir
ying it on 8.2! Can someone please comment? Thank you, ----- Shoaib Mir EnterpriseDB (www.enterprisedb.com)

Re: [SQL] Problem with SQL stored procedure

2006-12-08 Thread Shoaib Mir
Wrong mailing list to ask this :-) Try out a MS SQL Server one and you will get good help on that... Regards, Shoaib On 12/8/06, sid tow <[EMAIL PROTECTED]> wrote: Hi all I dont know if this is the right forum to post this but any way if you could help me or guide me to an appropriate

Re: [SQL] Multiple DB join

2006-08-14 Thread Shoaib Mir
I think using the contrib module 'dblink' (http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/) can help you here.Thanks, -- Shoaib MirEnterpriseDB (www.enterprisedb.com)On 8/15/06, Sumeet Ambre < [EMAIL PROTECTED]> wrote:Hi All,I have a database which consists of 20 million records an

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