[SQL] URGENT!!! changing Column size

2003-10-27 Thread mohan
Hi can we change the size of a column in postgres. I have a table named
institution and column name is name varchar2(25), i want to change it to
varchar2(50). Please let me know.

--Mohan






---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] Error with DROP column

2003-10-27 Thread mohan
Hi All i am trying to DROP the column but i keep getting this error.

 ALTER TABLE institution DROP COLUMN name CASCADE;
ERROR:  ALTER TABLE / DROP COLUMN is not implemented

please help me in solving this issue.







---(end of broadcast)---
TIP 8: explain analyze is your friend


[SQL] Problem: Postgresql not starting

2003-11-26 Thread mohan
Hi All
I am using postgresql 7.2 on Linux. It does not start when i am trying this
/etc/rc.d/init.d/postgresql restart.
It give an error saying "postmaster already running".
I have done
rm -f /var/lib/pgsql/data/postmaster.pid
and
rm -f /var/run/postmaster.pid

But it still says the same. whenever i restart with the above command
When say "stop" it says failed and when i say "start" it says postmaster
already running.
Please help me out

--m



---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[SQL] Postgres: MS Access and Tomcat

2003-11-26 Thread mohan
Hi All
I am using postgres database. Users of the DB include Web users thro tomcat
and internal user thr'o MS Access. The problem is the users of Access
sometimes do not close these connections and postgres fails saying too
many connections for the web users. Is there a way i can resolve this by
uncommenting the #Max_connections=32 in the postgresql.conf. What are the
effects of uncommenting this part in postgresql.conf. Do i need to make
any more changes when uncomment the Max_connections=32 in the
postgresql.conf file

Thank you very much

--Mohan



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[SQL] migration between databases and versions

2003-12-17 Thread mohan
I have been Red Hat linux 7.3 on my prod server. I have been running
postgres 7.2 on it.
I would like to upgrade it to the newest version of postgres.
1) Is there a version for redhat 7.3.
2) How stable is postgres 7.4 ?
I have another critical isssue.
My database has now changed.In our new release of the product we have
added few more columns to some of the tables in the database. But the
production does not have these fields. All the fields in the tables in
production are also in developement version. But there are some extra
fields in developement database that are not in production. There is a lot
of data already in the production database.
Now i need to add move the data from the old production database to new
one which has certain extra fields. Please let me know if it is possible
to do this migration, if yes how? using pg_dump?

Eg: Old database with data
   has a Table named 'person' with fields A,B
 New Database to be put under prodcution
   also has an Table named 'person' with field A, B,C

If i do a pg_dump from old to new does it fill the A,B and leave C alone
or will it give an error given that C is not a null field.

Please help me

--Mohan






---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [SQL] java.lang.StringIndexOutOfBoundsException: String index

2004-01-29 Thread mohan
Now i a get another wierd error

DEBUG] Transaction - -called safeRollback with null argument
java.sql.SQLException: ERROR:  SET AUTOCOMMIT TO OFF is no longer supported
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.setAutoCommit(AbstractJdbc1Connection.java:957)

They say its a driver problem i think i am having the right driver. I am
having RedHat Linux and postgres7.4 and pg73jdbc3.jar and jdbc-2.0.jar in
my class path. I donot understand what is going wrong

but in my server logs i also see this error for torque

[DEBUG] SharedPoolDataSourceFactory - -Starting initJdbc2Pool
[DEBUG] TorqueInstance - -getConfiguration() =
[EMAIL PROTECTED]
[DEBUG] AbstractDataSourceFactory - -applyConfiguration(null,
[EMAIL PROTECTED])
[DEBUG] AbstractDataSourceFactory -
-applyConfiguration([EMAIL PROTECTED],
[EMAIL PROTECTED])
[DEBUG] ConvertUtils - -Convert string 'SELECT 1' to class 'java.lang.String'
[ERROR] AbstractDataSourceFactory - -Property: validationQuery value:
SELECT 1 is not supported by DataSource:
org.apache.commons.dbcp.datasources.SharedPoolDataSource
[ERROR] AbstractDataSourceFactory - -Property: defaultMaxActive value: 16
is not supported by DataSource:
org.apache.commons.dbcp.datasources.SharedPoolDataSource

please let me know if any has an idea

Thanks in Advance

--Mohan




> O kyrios [EMAIL PROTECTED] egrapse stis Jan 29, 2004 :
>
>> Hi All
>>
>> I am having the torque3.1.jar and postgresql-7.4. I have compiled the
>> new jdbc driver called as postgresql.jar and have placed it in the lib
>> directory from where the ant scripts catch the jars. Whenever i try to
>> access through torque
>>
>> gestList = BaseGestlistPeer.doSelect(new Criteria());
>>
>> this error arises
>>
>> java.lang.StringIndexOutOfBoundsException: String index out of range:
>> 23
>> at java.lang.String.charAt(String.java:460)
>> at
>> org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653)
>> at
>> org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:398)
>
> Just from the above, some one could conclude you are running
> a 7.2.x postgresql driver.
>
> Make sure you havent messed up with the CLASSPATH.
> Also after ensuring your 7.4.1 postgresql.jar is in the right location,
> make sure you are running a 7.4.1 backend.
>
>>
>> I have searched all the lists and the answer i got is a jdbc driver
>> issue. Please let me know what i need to for getting around with this
>> problem. This happens only with this method in the whole application.
>> But the same method works when i did not use the new torque 3.1 and
>> everything happens smoothly.Please let me know if there is a way to
>> configure jdbc with torque or any other configuration issue for
>> postgres you know might have been creating this problem. I am having
>> one heck of a night mare wid this issue.
>>
>>
>> thanks
>>
>> --Mohan
>>
>>
>>
>> ---(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
>>
>
> --
> -Achilleus
>
>
> ---(end of broadcast)---
> TIP 8: explain analyze is your friend




---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460)

2004-01-29 Thread mohan
Hi All

I am having the torque3.1.jar and postgresql-7.4. I have compiled the new
jdbc driver called as postgresql.jar and have placed it in the lib
directory from where the ant scripts catch the jars. Whenever i try to
access through torque

gestList = BaseGestlistPeer.doSelect(new Criteria());

this error arises

java.lang.StringIndexOutOfBoundsException: String index out of range: 23
at java.lang.String.charAt(String.java:460)
at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653)
at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:398)

I have searched all the lists and the answer i got is a jdbc driver issue.
Please let me know what i need to for getting around with this problem.
This happens only with this method in the whole application. But the same
method works when i did not use the new torque 3.1 and everything happens
smoothly.Please let me know if there is a way to configure jdbc with
torque or any other configuration issue for postgres you know might have
been creating this problem. I am having one heck of a night mare wid this
issue.


thanks

--Mohan



---(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


PROBLEM SOLVEDRe: [SQL] java.lang.StringIndexOutOfBoundsException: String index

2004-01-30 Thread mohan
Thank you all guys. Thank you very much. Yeah it was the driver issue. I
was runnin postgres 7.4 but using the pg73jdbc3.jar driver. I did not know
that. Thank you all once again for your help.


--mohan

> O kyrios [EMAIL PROTECTED] egrapse stis Jan 29, 2004 :
>
>> Now i a get another wierd error
>>
>> DEBUG] Transaction - -called safeRollback with null argument
>> java.sql.SQLException: ERROR:  SET AUTOCOMMIT TO OFF is no longer
>> supported
>> at
>> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
>> at
>> org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
>> at
>> org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
>> at
>> org.postgresql.jdbc1.AbstractJdbc1Connection.setAutoCommit(AbstractJdbc1Connection.java:957)
>>
>> They say its a driver problem i think i am having the right driver. I
>> am having RedHat Linux and postgres7.4 and pg73jdbc3.jar and
>> jdbc-2.0.jar in my class path. I donot understand what is going wrong
>
> What java version (java -version), os (uname -a) are you running?
>
> What is this jdbc-2.0.jar?
>
> In any case postgres7.4 doesnt match (again!) pg73jdbc3.jar.
>
> You better use :
> java 1.4.1 (blackdown in linux, native jdk14 in FreeBSD)
> postgresql server 7.4.1
> postgresql jdbc 7.4.1
>
> Also as i said check your classpath.
>
>>
>> but in my server logs i also see this error for torque
>>
>> [DEBUG] SharedPoolDataSourceFactory - -Starting initJdbc2Pool
>> [DEBUG] TorqueInstance - -getConfiguration() =
>> [EMAIL PROTECTED]
>> [DEBUG] AbstractDataSourceFactory - -applyConfiguration(null,
>> [EMAIL PROTECTED])
>> [DEBUG] AbstractDataSourceFactory -
>> -applyConfiguration([EMAIL PROTECTED],
>> [EMAIL PROTECTED])
>> [DEBUG] ConvertUtils - -Convert string 'SELECT 1' to class
>> 'java.lang.String' [ERROR] AbstractDataSourceFactory - -Property:
>> validationQuery value: SELECT 1 is not supported by DataSource:
>> org.apache.commons.dbcp.datasources.SharedPoolDataSource
>> [ERROR] AbstractDataSourceFactory - -Property: defaultMaxActive value:
>> 16 is not supported by DataSource:
>> org.apache.commons.dbcp.datasources.SharedPoolDataSource
>>
>> please let me know if any has an idea
>>
>> Thanks in Advance
>>
>> --Mohan
>>
>>
>>
>>
>> > O kyrios [EMAIL PROTECTED] egrapse stis Jan 29, 2004 :
>> >
>> >> Hi All
>> >>
>> >> I am having the torque3.1.jar and postgresql-7.4. I have compiled
>> the new jdbc driver called as postgresql.jar and have placed it in
>> the lib directory from where the ant scripts catch the jars.
>> Whenever i try to access through torque
>> >>
>> >> gestList = BaseGestlistPeer.doSelect(new Criteria());
>> >>
>> >> this error arises
>> >>
>> >> java.lang.StringIndexOutOfBoundsException: String index out of
>> range: 23
>> >> at java.lang.String.charAt(String.java:460)
>> >> at
>> >> org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653) at
>> >> org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:398)
>> >
>> > Just from the above, some one could conclude you are running
>> > a 7.2.x postgresql driver.
>> >
>> > Make sure you havent messed up with the CLASSPATH.
>> > Also after ensuring your 7.4.1 postgresql.jar is in the right
>> location, make sure you are running a 7.4.1 backend.
>> >
>> >>
>> >> I have searched all the lists and the answer i got is a jdbc driver
>> issue. Please let me know what i need to for getting around with
>> this problem. This happens only with this method in the whole
>> application. But the same method works when i did not use the new
>> torque 3.1 and everything happens smoothly.Please let me know if
>> there is a way to configure jdbc with torque or any other
>> configuration issue for postgres you know might have been creating
>> this problem. I am having one heck of a night mare wid this issue.
>> >>
>> >>
>> >> thanks
>> >>
>> >> --Mohan
>> >>
>> >>
>> >>
>> >> ---(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
>> >>
>> >
>> > --
>> > -Achilleus
>> >
>> >
>> > ---(end of
>> broadcast)--- TIP 8: explain analyze is your
>> friend
>>
>>
>>
>
> --
> -Achilleus
>
>
> - To
> unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


[SQL] date function problem

2004-02-03 Thread mohan
Hi All
I have an expiration_date column in my table with data type as timestamp.
I need to set that as one year after the current time. how do i do that. I
am getting a casting problem whenever i try something.

something like now()+ 1 year. Please let me know

--mohan



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


[SQL] Unique Constraint with foreign Key

2004-02-10 Thread mohan
Hi all i am using postgres and torque
I have a column x in Table A of type varchar and NOT NULL. I want to
impose a unique key constraint on that table and column y is the primary
key.
I have another Table B with column x. can i make this column x as a
foreign key on column x in table A.
or Can i have varchar types  of size 50 as primary keys in Postgres.

please let me know

--Mohan



---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [SQL] Matching several rows

2006-01-18 Thread Vraj Mohan

It is easier to think of this as SET INTERSECTION which leads to:

SELECT id FROM urights WHERE right = 2
INTERSECT
SELECT id FROM urights WHERE right = 5
INTERSECT
SELECT id FROM urights WHERE right = 10

Ivan Steganov wrote:

Thank you to everyone for the great help!

I will evaluate all methods in our query (It is actually well complexer then
this sample) and choose the best one.

Is there any "scientific" name to this kind of "several rows match for one
result" data selection?

Ivan




---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster