Re: [GENERAL] alter table add column - specify where the column will go?

2010-11-23 Thread Alexander Farber
Easier to read... login, logout On Wed, Nov 24, 2010 at 8:45 AM, Szymon Guz wrote: > no > Why do you want to do anything like that? > -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-genera

Re: [GENERAL] alter table add column - specify where the column will go?

2010-11-23 Thread Dmitriy Igrishin
Hey Alexander, Ordinal positions of columns can't be set manually by ALTER TABLE. 2010/11/24 Alexander Farber > Hello, > > is there a syntax to add a column not at the last place, but > somewhere inbetween or do I have to dump/restore the table? > > For example if I'd like to add last_logout ri

Re: [GENERAL] alter table add column - specify where the column will go?

2010-11-23 Thread Thomas Kellerer
Alexander Farber, 24.11.2010 08:42: is there a syntax to add a column not at the last place No, because the order of the column is irrelevant (just as there is no order on the rows in a table) Simply select them in the order you like to have. Thomas -- Sent via pgsql-general mailing list (p

Re: [GENERAL] alter table add column - specify where the column will go?

2010-11-23 Thread Szymon Guz
On 24 November 2010 08:42, Alexander Farber wrote: > Hello, > > is there a syntax to add a column not at the last place, but > somewhere inbetween or do I have to dump/restore the table? > > For example if I'd like to add last_logout right after last_login: > > \d pref_users; >Tab

[GENERAL] alter table add column - specify where the column will go?

2010-11-23 Thread Alexander Farber
Hello, is there a syntax to add a column not at the last place, but somewhere inbetween or do I have to dump/restore the table? For example if I'd like to add last_logout right after last_login: \d pref_users; Table "public.pref_users" Column |Type |

Re: [GENERAL] plpyhton

2010-11-23 Thread c k
Hello, Does calling a pl/python function from each database connection load the python interpreter each time? what are the effects of using pl/python function in a environment where no. of concurrent connections are more and each user calls a pl/python function? Please give the details about how p

Re: [GENERAL] Passing a String with special character as an input

2010-11-23 Thread John R Pierce
On 11/23/10 12:34 PM, akp geek wrote: Hi - This is related to my earlier post. For the function I am passing a string. But the string some time has a single quote inside the string like "IT's a String Test" , How can I handle that, can you please help? at the SQL level, pass it

Re: [GENERAL] Passing a String with special character as an input

2010-11-23 Thread Pavel Stehule
Hello 2010/11/23 akp geek : > Hi - >            This is related to my earlier post. For the function I am passing > a string. But the string some time has a single quote inside the string like > "IT's a String Test" , How can I handle that, can you please help? on stored procedure level you can d

Re: [GENERAL] What is Dialect

2010-11-23 Thread Craig Ringer
On 11/22/2010 03:32 PM, Adarsh Sharma wrote: Dear all, I am reading about Dialects of different databases. Yet I can't understand what is the need of dialect in Postgres or any other like Hibernate uses Dialect of all Databases for ORM. What is it & How can we create our own Dialect ? If you h

Re: [GENERAL] Problem with replace function in postgres

2010-11-23 Thread akp geek
I used pg_catalog.replace, it worked. Thanks for the help On Tue, Nov 23, 2010 at 3:32 PM, Pavel Stehule wrote: > Hello > > it working on my comp > > postgres=# select mystr, test_repl(mystr) replaced_strfrom str_table; > mystr | replaced_str > --

Re: [GENERAL] "could not accept SSPI security context"

2010-11-23 Thread Brar Piening
On Mon, 22 Nov 2010 13:43:14 +0100, Magnus Hagander wrote: Hmm. That's a simple SEC_E_LOGON_DENIED. Simply meaning usedname/password is incorrect. The security eventlog on the server (or domain controller) might have more information around it. If not, I'm not sure what's wrong there - if it hap

Re: [GENERAL] very basic SQL question

2010-11-23 Thread Dan Kortschak
Thanks for that - yes very helpful. Good to know what is possible. Dan On Tue, 2010-11-23 at 10:27 +0100, Matthieu Huin wrote: > A similar question was discussed here about 3 weeks ago : > http://archives.postgresql.org/pgsql-general/2010-11/msg00110.php > > The "UPSERT" facility not being impl

[GENERAL] Passing a String with special character as an input

2010-11-23 Thread akp geek
Hi - This is related to my earlier post. For the function I am passing a string. But the string some time has a single quote inside the string like "IT's a String Test" , How can I handle that, can you please help? CREATE OR REPLACE FUNCTION test_repl(x character varying) RETURNS c

Re: [GENERAL] Problem with replace function in postgres

2010-11-23 Thread Pavel Stehule
Hello it working on my comp postgres=# select mystr, test_repl(mystr) replaced_strfrom str_table; mystr | replaced_str ---+-- This road is INDEFLY CLSD | This road is indefinitely closed That is INDEFLY open

Re: [GENERAL] Escaping string for LIKE

2010-11-23 Thread Dmitriy Igrishin
Hey David, I guess, that you should escape, like this dmitigr=> SELECT regexp_replace('di_ma%', '(%|_)', E'\\1', 'g'); regexp_replace di\_ma\% 2010/11/23 David Sheldon > If I have a string, and I want to search for everything that starts with > that string then I could

Re: [GENERAL] Problem with replace function in postgres

2010-11-23 Thread akp geek
CREATE OR REPLACE FUNCTION test_repl(x character varying) RETURNS character varying AS $BODY$ DECLARE ret_var varchar(4000); a record; begin ret_var := x; for a in select * from lookup loop ret_var := replace(ret_var,a.code,a.codeword); end loop; return ret_var; END; $BODY$ LANGUAGE 'plpgsql

Re: [GENERAL] Problem with replace function in postgres

2010-11-23 Thread Pavel Stehule
Hello please, can you send a source code of your function? Regards Pavel Stehule 2010/11/23 akp geek : > Dear all - >                 I am having trouble with replace function inside a function. >  If I do the same replace function outside it works fine, Following example > clearly explains my

[GENERAL] Problem with replace function in postgres

2010-11-23 Thread akp geek
Dear all - I am having trouble with replace function inside a function. If I do the same replace function outside it works fine, Following example clearly explains my problem. Can you please help? create table str_table ( mystr varchar(1000)); insert into str_table values ( 'Thi

Re: [GENERAL] very basic SQL question

2010-11-23 Thread Matthieu Huin
A similar question was discussed here about 3 weeks ago : http://archives.postgresql.org/pgsql-general/2010-11/msg00110.php The "UPSERT" facility not being implemented yet, I don't think it is possible to do much better than what you came up with. Assuming the column(s) holding the distinctiv

Re: Fwd: [GENERAL] Postgres forums ... take 2

2010-11-23 Thread Thom Brown
On 22 November 2010 14:05, Bruce Momjian wrote: > Magnus Hagander wrote: >> On Sat, Nov 20, 2010 at 16:54, Bruce Momjian wrote: >> > Elliot Chance wrote: >> >> > Also, if someone registers on the forum, do they get a major domo >> >> > registration email? ?And if so, would this be set to receive

[GENERAL] Escaping string for LIKE

2010-11-23 Thread David Sheldon
If I have a string, and I want to search for everything that starts with that string then I could do: SELECT * FROM users WHERE name LIKE string || '%'; Now, if string contains \, _ or % then it won't do what I expect. Is there a built-in function that I can call to escape the string so that

Re: [GENERAL] postmaster.pid does not exist. cannot start postgres server on ubuntu

2010-11-23 Thread Matthew Walden
Jen, Regarding the first point, is postgres actually running? You can check this by typing the following at a terminal - ps -ef|grep postgres Reload configuration is used to tell PostgreSQL to read in the configuration file for any chances since the database started. If you want to start the d

[GENERAL] Syntax error near returning

2010-11-23 Thread Jonathan Tripathy
Hi Everyone, When I create a prepared statement like this in java (using JDBC): pStmt = conn.prepareStatement(qry); everything works ok. However when I want a scrollable resultset and use this: pStmt = conn.prepareStatement(qry,ResultSet.TYPE_SCROLL_INSENSITIVE); I get a syntax error: org.pos

Re: [GENERAL] Discerning user vs trigger based updates

2010-11-23 Thread Tom Lane
"Gauthier, Dave" writes: > I have an update trigger on a table that in turn updates other records of > that same table. I need to be able to discern between when a user is > updating a record in the table vs when the update trigger is reflexively > calling itself. Is there an elegant way to d

[GENERAL] Discerning user vs trigger based updates

2010-11-23 Thread Gauthier, Dave
Hi: I have an update trigger on a table that in turn updates other records of that same table. I need to be able to discern between when a user is updating a record in the table vs when the update trigger is reflexively calling itself. Is there an elegant way to do this? Thanks in Advance

[GENERAL] plpyhton

2010-11-23 Thread c k
Hello, Does calling a pl/python function from each database connection load the python interpreter each time? what are the effects of using pl/python function in a environment where no. of concurrent connections are more and each user calls a pl/python function? Please give the details about how p

[GENERAL] postmaster.pid does not exist. cannot start postgres server on ubuntu

2010-11-23 Thread Jennifer Trey
I am getting the following error when I go to Application -> PostgreSQL -> Reload Configuration " Please enter your password if requested. pg_ctl: PID file "/home/Jen/Installed/PostgreSQL/data/postmaster.pid" does not exist Is server running? Press to continue... " I have installed Postgresql f

Re: [GENERAL] json data type

2010-11-23 Thread Tom Lane
Armand Turpel writes: > A project in which i'm involved, make use of json data type for storing > some data sets. I have read that there is some work in progress to > implement json datatype support in postgres. So my question is; when and > in which version of postgres we can expect this impl

Re: [GENERAL] Connection pool

2010-11-23 Thread Vick Khera
On Tue, Nov 23, 2010 at 4:42 AM, Mark Gabriel Paylaga wrote: > When two requests are received at the same time, both of the requests  will > use the same db connection resulting in an error: > Started transaction while transaction still > active > > You have multiple threads sharing the same conn

Re: [GENERAL] very basic SQL question

2010-11-23 Thread Sam Mason
On Tue, Nov 23, 2010 at 02:09:19PM +1030, Dan Kortschak wrote: > I want to be able to insert, > uniquely, biological sequences into a table returning the sequence id - > this part is fine. However, if the sequence already exists in the table > I want to return to id. The term you're looking for is

Re: [GENERAL] Debug advice when postgres connection maxing out

2010-11-23 Thread Robert Gravsjö
On 2010-11-22 20.41, anypossibility wrote: Server: OS X 10.5 PostgreSQL version: 8.3 We experience this connection maxing out once in the full moon. The request from client reaches to the server but client never receive response back. The queries are very simple update on one record or selec

Re: [GENERAL] json data type

2010-11-23 Thread Armand Turpel
On 23/11/2010 09:34, Mike Christensen wrote: I'd be interested in knowing what functionality would come with a JSON data type, like could you query for all rows with an X property of> 5 or something, eg {Y: 1, X: 6} Yes, as far as i know, you can make queries on json content #

Re: [GENERAL] Connection pool

2010-11-23 Thread Mark Gabriel Paylaga
Hi, Regarding connection pooling... I may actually not need connection pooling... I have one service to write to db. The service receives one or more requests at the same time from different modules. When two requests are received at the same time, both of the requests will use the same db conne

Re: [GENERAL] finding rows with invalid characters

2010-11-23 Thread Dmitriy Igrishin
Sim, are you sure that encoding of the dump and the database in which you are trying to restore it are same ? 2010/11/23 Sim Zacks > Thanks for your help. > > I think a trigger will actually be the easiest. The way i can tell if there > is invalid data is simply to do an Upper(text) and if it h

Re: [GENERAL] finding rows with invalid characters

2010-11-23 Thread Sim Zacks
Thanks for your help. I think a trigger will actually be the easiest. The way i can tell if there is invalid data is simply to do an Upper(text) and if it has invalid data it fails. I dumped the fixed database. Now I have a years worth of backups that I can't restore a specific table from. I

Re: [GENERAL] json data type

2010-11-23 Thread Mike Christensen
> A project  in which i'm involved, make use of json data type for storing > some data sets. I have read that there is some work in progress to implement > json datatype support in postgres. So my question is; when and in which > version of postgres we can expect this implementation? I actually st

[GENERAL] json data type

2010-11-23 Thread Armand Turpel
Hi, A project in which i'm involved, make use of json data type for storing some data sets. I have read that there is some work in progress to implement json datatype support in postgres. So my question is; when and in which version of postgres we can expect this implementation? Thanks, atu