Re: [GENERAL] Sql server to Postgres Migration issue!

2017-05-18 Thread Adrian Klaver
On 05/18/2017 05:46 AM, Rakesh Mamidala wrote: Hi Buddies, I am trying to migrate Sql server database to PostgreSql, But i am failing with the error like MTK-03000: General Error java.lang.ClassCastException: org.postgresql.jdbc.PgConnection cannot be cast to org.postgresql.jdbc2.AbstractJdb

Re: [SPAM] [GENERAL] Sql server to Postgres Migration issue!

2017-05-18 Thread Moreno Andreo
Il 18/05/2017 14:46, Rakesh Mamidala ha scritto: java.lang.ClassCastException: org.postgresql.jdbc.PgConnection cannot be cast to org.postgresql.jdbc2.AbstractJdbc2Connection  This appea

[GENERAL] Sql server to Postgres Migration issue!

2017-05-18 Thread Rakesh Mamidala
Hi Buddies, I am trying to migrate Sql server database to PostgreSql, But i am failing with the error like MTK-03000: General Error java.lang.ClassCastException: org.postgresql.jdbc.PgConnection cannot be cast to org.postgresql.jdbc2.AbstractJdbc2Connection Please anybody can help me to resolve

Re: [GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Torsten Förtsch
Did you try DISTINCT ON? postgres=# table x; id | qid | uid +-+ 1 | 25 | 1 2 | 25 | 1 3 | 25 | 1 4 | 26 | 1 5 | 26 | 1 6 | 27 | 1 7 | 27 | 1 8 | 25 | 2 9 | 25 | 2 10 | 25 | 2 11 | 26 | 2 12 | 26 | 2 1

Re: [GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Adrian Klaver
On 12/17/2016 07:25 AM, Arup Rakshit wrote: Hi, Here is a sample data from table "quiz_results": id | question_id | user_id +-+ 2 | 25 | 5142670086 3 | 26 | 4 | 26 | 5 | 27 | 6 | 25 | 5142670086 7 | 2

Re: [GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Melvin Davidson
On Sat, Dec 17, 2016 at 10:25 AM, Arup Rakshit wrote: > Hi, > > Here is a sample data from table "quiz_results": > > id | question_id | user_id > +-+ > 2 | 25 | 5142670086 > 3 | 26 | > 4 | 26 | > 5 | 27 | > 6 | 25

[GENERAL] SQL query problem of a Quiz program

2016-12-17 Thread Arup Rakshit
Hi, Here is a sample data from table "quiz_results": id | question_id | user_id +-+ 2 | 25 | 5142670086 3 | 26 | 4 | 26 | 5 | 27 | 6 | 25 | 5142670086 7 | 25 | 5142670086 8 | 25 | 5142670086

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread Francisco Olarte
CCing to the list ( if you are new to this list, messages come from the sender address, you have to use "reply all" ( at least in my MUA, web gmail ) to make your replies appear in the list ). On Thu, Aug 18, 2016 at 3:03 PM, wrote: > Hi Francisco, > thanks a lot. I will give it a try later Do

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread David G. Johnston
On Thu, Aug 18, 2016 at 4:56 AM, wrote:​ > select custid, count(vendid) as c415 from cv where vendid = 415 group by > custid > ​[...] > > Is there a better way (by creating an aggregate function, perhaps) > ​You may find crosstab in the tablefuncs extension to be of use. ​ https://www.postgres

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread Ladislav Lenart
Hello. On 18.8.2016 10:56, haman...@t-online.de wrote: > > Hi, > > I have a table cv with custid and vendid columns. Every entry represents the > purchase of a product > available from a specific vendor. > Now, for a set of "interesting" vendors, I would like to select a new table > custid, c

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread Francisco Olarte
On Thu, Aug 18, 2016 at 10:56 AM, wrote: > I have a table cv with custid and vendid columns. Every entry represents the > purchase of a product > available from a specific vendor. > Now, for a set of "interesting" vendors, I would like to select a new table > custid, c415, c983, c1256 > based up

[GENERAL] SQL help - multiple aggregates

2016-08-18 Thread hamann . w
Hi, I have a table cv with custid and vendid columns. Every entry represents the purchase of a product available from a specific vendor. Now, for a set of "interesting" vendors, I would like to select a new table custid, c415, c983, c1256 based upon part queries select custid, count(vendid) as

Re: [GENERAL] [SQL] plan not correct?

2016-03-21 Thread Adrian Klaver
On 03/21/2016 08:29 AM, Bert wrote: That is easy to check. Let's do the same test again: # select count(1) from dlp.st_itemseat; count --- 12 (1 row) # select count(1) from loaddlp.st_itemseat_insert; count --- 87 --> of which 12 are already in the dlp.st_itemseat tab

Re: [GENERAL] [SQL] plan not correct?

2016-03-21 Thread Adrian Klaver
On 03/21/2016 08:29 AM, Bert wrote: My mistake, Cced wrong list. That is easy to check. Let's do the same test again: # select count(1) from dlp.st_itemseat; count --- 12 (1 row) # select count(1) from loaddlp.st_itemseat_insert; count --- 87 --> of which 12 are alr

Re: [GENERAL] [SQL] plan not correct?

2016-03-21 Thread Bert
That is easy to check. Let's do the same test again: # select count(1) from dlp.st_itemseat; count --- 12 (1 row) # select count(1) from loaddlp.st_itemseat_insert; count --- 87 --> of which 12 are already in the dlp.st_itemseat table (1 row) # explain analyze * QUERY PLA

Re: [GENERAL] [SQL] plan not correct?

2016-03-21 Thread Adrian Klaver
On 03/21/2016 07:54 AM, Bert wrote: Ccing list Hello Ardian, The PostgreSQL version is 9.4.5 The reason I have the 'returning' statement in the update section is because I only insert the data that has not been updated. I don't see why I would need to return anything in the insert section? W

Re: [GENERAL] [SQL] refer function name by a variable in the function body

2016-02-16 Thread hubert depesz lubaczewski
On Tue, Feb 16, 2016 at 09:41:18AM -0600, Suresh Raja wrote: > I use the function name in the body of pgsql code of the same function. Is > the function name set to any variable that i can easily reference. Now I'm > hard coding the function name in the code. > In the above Raise info i use selec

Re: [GENERAL] [SQL] Q: documentation bug ?

2016-02-04 Thread Fabrízio de Royes Mello
On 04-02-2016 08:53, Karsten Hilbert wrote: > Hello all, > > the online documentation for REINDEX > > http://www.postgresql.org/docs/9.5/static/sql-reindex.html > > talks about VERBOSE > > Synopsis > > REINDEX [ ( { VERBOSE } [, ...] ) ] { INDEX | TABLE | SCHEMA | DATABASE >

Re: [GENERAL] [SQL] Q: documentation bug ?

2016-02-04 Thread Tom Lane
Karsten Hilbert writes: > On Thu, Feb 04, 2016 at 12:00:45PM +0100, Vik Fearing wrote: >>> REINDEX [ ( { VERBOSE } [, ...] ) ] { INDEX | TABLE | SCHEMA | DATABASE | >>> SYSTEM } name >>> Does this constitute a bug in the documentation or in the Debian version of >>> PG ? >> Neither. It's a li

Re: [GENERAL] [SQL] Q: documentation bug ?

2016-02-04 Thread Karsten Hilbert
On Thu, Feb 04, 2016 at 12:00:45PM +0100, Vik Fearing wrote: >> REINDEX [ ( { VERBOSE } [, ...] ) ] { INDEX | TABLE | SCHEMA | DATABASE >> | SYSTEM } name ... >> Does this constitute a bug in the documentation or in the Debian version of >> PG ? > > Neither. It's a little bit obscure beca

[GENERAL] [SQL] Q: documentation bug ?

2016-02-04 Thread Karsten Hilbert
Hello all, the online documentation for REINDEX http://www.postgresql.org/docs/9.5/static/sql-reindex.html talks about VERBOSE Synopsis REINDEX [ ( { VERBOSE } [, ...] ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } name [...] VERBOSE

Re: [GENERAL] [SQL] plv8 installation problem

2016-01-05 Thread Adrian Klaver
On 01/05/2016 09:17 AM, Belju Paul wrote: Please include list in replies. Yes plv8.dll exists. I found plv8 downloads for win 32 and for win 64 bit. But there is a difference in file count in bin folder. The exe file d8.exe is absent in win32 bit down load file. I downloaded and installed th

Re: [GENERAL] [SQL] plv8 installation problem

2016-01-05 Thread Adrian Klaver
On 01/05/2016 09:02 AM, Belju Paul wrote: Ccin list Both Postgre 9.4 and plv8 are downloaded from postgre site So does plv8.dll exist? Belju Paul On Jan 5, 2016 9:30 PM, "Adrian Klaver" mailto:adrian.kla...@aklaver.com>> wrote: On 01/05/2016 12:56 AM, Belju Paul wrote: Hi,

Re: [GENERAL] SQL conversion tool

2015-11-18 Thread Ran Fedida
>From my work with it and as mentioned before Ora2Pg is highly recommended and very powerfull tool to migration database from Oracle to PostgreSQL. Ran Fedida. בתאריך 18 בנוב׳ 2015 12:25,‏ "Thomas Kellerer" כתב: > Sachin Srivastava schrieb am 18.11.2015 um 10:41: > > > Please inform which is the

Re: [GENERAL] SQL conversion tool

2015-11-18 Thread dinesh kumar
On Wed, Nov 18, 2015 at 10:58 AM, dinesh kumar wrote: > On Wed, Nov 18, 2015 at 10:41 AM, Sachin Srivastava < > ssr.teleat...@gmail.com> wrote: > >> Hi, >> >> Please inform which is the best tool for SQL conversion because I have to >> migration Oracle database into PostgreSQL. >> >> > Pentaho is

Re: [GENERAL] SQL conversion tool

2015-11-18 Thread dinesh kumar
On Wed, Nov 18, 2015 at 11:24 AM, Thomas Kellerer wrote: > Sachin Srivastava schrieb am 18.11.2015 um 10:41: > > > Please inform which is the best tool for SQL conversion because I have > to migration Oracle database into PostgreSQL. > > Ora2Pg works quite well http://ora2pg.darold.net/ > > +1

Re: [GENERAL] SQL conversion tool

2015-11-18 Thread Thomas Kellerer
Sachin Srivastava schrieb am 18.11.2015 um 10:41: > Please inform which is the best tool for SQL conversion because I have to > migration Oracle database into PostgreSQL. Ora2Pg works quite well http://ora2pg.darold.net/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) T

Re: [GENERAL] SQL conversion tool

2015-11-18 Thread dinesh kumar
On Wed, Nov 18, 2015 at 10:41 AM, Sachin Srivastava wrote: > Hi, > > Please inform which is the best tool for SQL conversion because I have to > migration Oracle database into PostgreSQL. > > Pentaho is the tool you need to have a look. Also, talend works great. You can check my blog

[GENERAL] SQL conversion tool

2015-11-18 Thread Sachin Srivastava
Hi, Please inform which is the best tool for SQL conversion because I have to migration Oracle database into PostgreSQL. Regards, SS

Re: [GENERAL] SQL pre-processor, like ecpg, for other languages?

2015-08-11 Thread John McKown
My thanks. I didn't think to look at OpenCOBOL, just GNU and just couldn't seem to find anything. ​I'm downloading the FireBird code now to see how they did it. I didn't do very well in the "Compiler Theory" class in college. I'm a tad better now, but not even a novice really. ​ -- Schrodinger

Re: [GENERAL] SQL pre-processor, like ecpg, for other languages?

2015-08-11 Thread Reid Thompson
On Tue, 2015-08-11 at 14:32 -0400, an unknown sender wrote: > On Tue, 2015-08-11 at 07:20 -0500, John McKown wrote: > > > PostgreSQL comes with ecpg which is a "pre-processor" to handle embedded > > EXEC > > SQL startements in C (OK, you already know that). I am wondering if anyone > > knows of

Re: [GENERAL] SQL pre-processor, like ecpg, for other languages?

2015-08-11 Thread Reid Thompson
On Tue, 2015-08-11 at 07:20 -0500, John McKown wrote: > PostgreSQL comes with ecpg which is a "pre-processor" to handle embedded EXEC > SQL startements in C (OK, you already know that). I am wondering if anyone > knows of any such program for other compiled languages, in particular GNU > COBOL or

[GENERAL] SQL pre-processor, like ecpg, for other languages?

2015-08-11 Thread John McKown
PostgreSQL comes with ecpg which is a "pre-processor" to handle embedded EXEC SQL startements in C (OK, you already know that). I am wondering if anyone knows of any such program for other compiled languages, in particular GNU COBOL or ADA? (please don't shudder, I have my reasons as strange as the

Re: [GENERAL] [SQL] encrypt psql password in unix script

2015-07-08 Thread John R Pierce
On 7/8/2015 12:01 PM, Steve Midgley wrote: My suggestion is to put it in an environment variable and set that variable from a shell startup script that is secured with permissions. (http://www.postgresql.org/docs/9.4/static/libpq-envars.html) that just moves the problem, now the plaintext pa

Re: [GENERAL] [SQL] encrypt psql password in unix script

2015-07-08 Thread Xavier Stevens
I use envcrypt for things like this locally. Just encrypt the file with your own PGP key. https://github.com/whilp/envcrypt On Wed, Jul 8, 2015 at 12:01 PM, Steve Midgley wrote: > My suggestion is to put it in an environment variable and set that > variable from a shell startup script that is s

Re: [GENERAL] [SQL] encrypt psql password in unix script

2015-07-08 Thread Steve Midgley
My suggestion is to put it in an environment variable and set that variable from a shell startup script that is secured with permissions. ( http://www.postgresql.org/docs/9.4/static/libpq-envars.html) If you can't do that, the only other method I've used is to setup Postgres with Ansible, and stor

Re: [GENERAL] SQL Server access from PostgreSQL

2015-06-07 Thread Serge Fonville
If you use odbc you should be able to use https://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl 2015-06-07 1:08 GMT+02:00 Geoff Montee : > On Mon, May 18, 2015 at 11:24 AM, Geoff Montee > wrote: >

Re: [GENERAL] SQL Server access from PostgreSQL

2015-06-06 Thread Geoff Montee
On Mon, May 18, 2015 at 11:24 AM, Geoff Montee wrote: > > The NOTICE right before the error might provide useful information: > > NOTICE: DB-Library notice: Msg #: 40508, Msg state: 1, Msg: USE > statement is not supported to switch between databases. Use a new > connection to connect to a differ

Re: [GENERAL] [SQL] extracting PII data and transforming it across table.

2015-05-27 Thread John R Pierce
On 5/21/2015 9:51 AM, Suresh Raja wrote: I'm looking at directions or help in extracting data from production and alter employee id information while extracting. But at the same time maintain referential integrity across tables. Is it possible to dump data to fla

Re: [GENERAL] [SQL] extracting PII data and transforming it across table.

2015-05-21 Thread Suresh Raja
On Thu, May 21, 2015 at 11:33 AM, Steve Midgley wrote: > I would update the IDs using SQL before dumping if possible. If necessary > clone the tables, adjust the IDs and then dump. SQL has better tools than > most languages/scripts to adjust values in columns across multiple > entities. Plus it s

Re: [GENERAL] [SQL] extracting PII data and transforming it across table.

2015-05-21 Thread Steve Midgley
I would update the IDs using SQL before dumping if possible. If necessary clone the tables, adjust the IDs and then dump. SQL has better tools than most languages/scripts to adjust values in columns across multiple entities. Plus it should be easier to build some test queries in SQL to validate tha

Re: [GENERAL] SQL Server access from PostgreSQL

2015-05-18 Thread Geoff Montee
: 1, Msg: Changed > language setting to us_english., Server: ms, Process: , Line: 1, > Level: 0 > NOTICE: DB-Library notice: Msg #: 40508, Msg state: 1, Msg: USE > statement is not supported to switch between databases. Use a new > connection to connect to a different database., Serv

Re: [GENERAL] SQL Server access from PostgreSQL

2015-05-18 Thread Filip Rembiałkowski
ment is not supported to switch between databases. Use a new connection to connect to a different database., Server: ms, Process: , Line: 1, Level: 16 ERROR: DB-Library error: DB #: 40508, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: (null), Level: 16 Thanks, F

Re: [GENERAL] SQL Server access from PostgreSQL

2015-05-18 Thread Geoff Montee
Hi Filip, On Mon, May 18, 2015 at 7:52 AM, Filip Rembiałkowski wrote: > Hi. > > I will be happy to hear your opinion which one is better - odbc_fdw or > tds_fdw? > > In terms of performance / stability / convenience. > > (Pg on OpenSuse, MS SQL on Win2008 ) > > Thanks! > I'm the developer of td

[GENERAL] SQL Server access from PostgreSQL

2015-05-18 Thread Filip Rembiałkowski
Hi. I will be happy to hear your opinion which one is better - odbc_fdw or tds_fdw? In terms of performance / stability / convenience. (Pg on OpenSuse, MS SQL on Win2008 ) Thanks! -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] [SQL] documenting tables version control

2015-05-05 Thread Steve Midgley
System catalogs should help, unless I misunderstand your question: http://www.postgresql.org/docs/9.4/static/catalogs.html http://www.postgresql.org/docs/9.4/static/view-pg-tables.html http://stackoverflow.com/questions/20698169/how-to-use-postgres-pg-tables-to-compare-contraints On Tue, May 5

Re: [GENERAL] [SQL] function to send email with query results

2015-04-19 Thread Anil Menon
Using Apache camel Listen/notify ->PGEvent Component (http://camel.apache.org/pgevent.html) -> Mail Component (http://camel.apache.org/mail.html) You can also then handle all the exceptions of the email server easily. On Sun, Apr 19, 2015 at 6:42 AM, Jim Nasby wrote: > On 4/18/15 12:52 AM, Dav

Re: [GENERAL] [SQL] function to send email with query results

2015-04-18 Thread Jim Nasby
On 4/18/15 12:52 AM, David G. Johnston wrote: On Friday, April 17, 2015, Suresh Raja mailto:suresh.raja...@gmail.com>> wrote: Hi all: I'm looking to write a function to send email with result of a query.Is it possible to send email with in a function. Any help is appreciate

Re: [GENERAL] [SQL] function to send email with query results

2015-04-17 Thread David G. Johnston
On Friday, April 17, 2015, Suresh Raja wrote: > Hi all: > > I'm looking to write a function to send email with result of a query. > Is it possible to send email with in a function. Any help is appreciated. > > Yes...though neither the neither the sql nor the plpgsql languages have the necessary

Re: [GENERAL] [SQL] check data for datatype

2015-04-07 Thread Jim Nasby
On 4/7/15 11:59 AM, Gerardo Herzig wrote: I guess that could need something like (untested) delete from bigtable text_column !~ '^[0-9][0-9]*$'; Won't work for... .1 -1 1.1e+5 ... Really you need to do something like what Jerry suggested if you want this to be robust. -- Jim Nasby, Data Ar

Re: [GENERAL] [SQL] check data for datatype

2015-04-07 Thread Gerardo Herzig
I guess that could need something like (untested) delete from bigtable text_column !~ '^[0-9][0-9]*$'; HTH Gerardo - Mensaje original - > De: "Suresh Raja" > Para: pgsql-general@postgresql.org, pgsql-...@postgresql.org > Enviados: Viernes, 27 de Marzo 2015 15:08:43 > Asunto: [SQL] chec

Re: [GENERAL] [SQL] Link Office Word form document with data from PostgreSQL

2015-03-30 Thread Hector Vass
If you have windows then yes something like vba to pull data into MS Office Word .. search google for 'ms word odbc connection' a postgres mailing list is not the right place to do this search If you are on *nix don't have/want windows & office products but want to generate/write to a MS Offic

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-24 Thread Adrian Klaver
On 02/24/2015 11:36 AM, Gavin Flower wrote: On 25/02/15 04:29, Adrian Klaver wrote: On 02/24/2015 06:25 AM, George Woodring wrote: -- In your original post you mentioned that access to the databases is through a Web server. -- Is there just one Web server with one time zone? We have 2 web

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-24 Thread Gavin Flower
On 25/02/15 04:29, Adrian Klaver wrote: On 02/24/2015 06:25 AM, George Woodring wrote: -- In your original post you mentioned that access to the databases is through a Web server. -- Is there just one Web server with one time zone? We have 2 web servers that are clustered together. They a

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-24 Thread George Woodring
> > > > So: > > JDBC Web servers(US/East) <---> 90 database (5 different timezones) > > Therefore everything to the end user is passed through the Web servers? > > Is there a reason why the databases have different timezones? > > Seems to me less complicated to have all the databases share the

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-24 Thread Adrian Klaver
On 02/24/2015 06:25 AM, George Woodring wrote: -- In your original post you mentioned that access to the databases is through a Web server. -- Is there just one Web server with one time zone? We have 2 web servers that are clustered together. They are both set to Eastern since that is the

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-24 Thread Dave Cramer
George, One solution for you might be to write a C function which gets the OS timezone and then you can execute set timezone=server_timezone(); Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 24 February 2015 at 09:25, George Woodring wrote: > -- In your original post

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-24 Thread George Woodring
-- In your original post you mentioned that access to the databases is through a Web server. -- Is there just one Web server with one time zone? We have 2 web servers that are clustered together. They are both set to Eastern since that is the timezone they are located in. iGLASS Networks www.

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Dave Cramer
On 23 February 2015 at 16:31, Tom Lane wrote: > Dave Cramer writes: > > Everytime you get a connection the driver will issue set timezone ... > > It does not change the default time zone for the server (AFAICS) > > Hmm ... depending on exactly how you issue it, it might become the default > for

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Tom Lane
Dave Cramer writes: > Everytime you get a connection the driver will issue set timezone ... > It does not change the default time zone for the server (AFAICS) Hmm ... depending on exactly how you issue it, it might become the default for the session, I think. I seem to recall that parameter sett

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Dave Cramer
George, Everytime you get a connection the driver will issue set timezone ... It does not change the default time zone for the server (AFAICS) Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 23 February 2015 at 15:29, Adrian Klaver wrote: > On 02/23/2015 12:15 PM, George

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Adrian Klaver
On 02/23/2015 12:15 PM, George Woodring wrote: This is what I was looking for, however the JDBC does something to make its timezone the default. My cluster is set to GMT, I have a DB that is set to US/Pacific, when I get the connection from JDBC it is US/Eastern. The reset command does not aff

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread George Woodring
This is what I was looking for, however the JDBC does something to make its timezone the default. My cluster is set to GMT, I have a DB that is set to US/Pacific, when I get the connection from JDBC it is US/Eastern. The reset command does not affect it. I can set timezone in the code to 'US/Pa

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Dave Cramer
For posterity please be aware this will very likely break any timestamps transfer using JDBC and binary transfer. This is not recommended for general consumption Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 23 February 2015 at 10:49, Tom Lane wrote: > George Woodring

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Tom Lane
George Woodring writes: > Yes, that is where we think we are heading, the issue is that the code does > not know what it needs to be set back to. We have 90 databases with 5 > different time zones. I was just hoping for a more elegant solution than > writing a lookup table that says if you are c

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Dave Cramer
Timestamps have always been a bit of a pain since JDBC does not support both with and without timezones. It really only supports timestamps with timezone. We have made decisions in the driver which are not optimal for everyone. The reason it does this is for binary transfers of data. We need to co

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread George Woodring
Yes, that is where we think we are heading, the issue is that the code does not know what it needs to be set back to. We have 90 databases with 5 different time zones. I was just hoping for a more elegant solution than writing a lookup table that says if you are connecting to db x then set to tim

Re: [GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread Dave Cramer
Well you could always just put it back to whatever you want when you open the connection ie "set timezone " Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 23 February 2015 at 08:40, George Woodring wrote: > Anyone have a suggestion for setting the timezone back to

[GENERAL] SQL solution for my JDBC timezone issue

2015-02-23 Thread George Woodring
Anyone have a suggestion for setting the timezone back to the Postgres db default on a connection. JDBC now sets the timezone to be the client which is my web server and ignores the default timezone that I have set in the DB. There are large parts of my code that I have never worried about timezo

Re: [GENERAL] [SQL] check if the same function is already running, then exit!

2015-01-26 Thread Pavel Stehule
Hi you can use a advisory locks for singleton implementation http://www.postgresql.org/docs/9.4/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS Regards Pavel 2015-01-26 20:58 GMT+01:00 Suresh Raja : > Before running a running a function, i would check only 1 instance is > running. If al

Re: [GENERAL] [SQL] commit inside a function failing

2015-01-24 Thread Christopher Browne
The straightforward answer is that stored functions always run *inside* the context of a preexisting transaction, therefore you cannot request a separate transaction from within a stored function. What you are asking is fairly deeply impossible.

Re: [GENERAL] [SQL] commit inside a function failing

2015-01-23 Thread k...@rice.edu
On Fri, Jan 23, 2015 at 01:56:53PM -0600, Suresh Raja wrote: > Hi All: > > We are running a function with a loop in it. We tried > commit; > We are getting error with above command. How can i easily commit withing > a function. > > > Thanks, > -SR PostgreSQL functions run within a transaction

Re: [GENERAL] [SQL] commit inside a function failing

2015-01-23 Thread Adrian Klaver
On 01/23/2015 11:56 AM, Suresh Raja wrote: Hi All: We are running a function with a loop in it. We tried commit; We are getting error with above command. How can i easily commit withing a function. Functions do not have transactions inside them. If you are using plpgsql you can use EXCEPTIO

Re: [GENERAL] [SQL] commit inside a function failing

2015-01-23 Thread Pavel Stehule
Hi 2015-01-23 20:56 GMT+01:00 Suresh Raja : > Hi All: > > We are running a function with a loop in it. We tried > commit; > We are getting error with above command. How can i easily commit withing > a function. > > It is not possible in PostgreSQL Regards Pavel Stehule > > Thanks, > -SR >

Re: FW: [GENERAL] SQL rolling window without aggregation

2014-12-08 Thread David Johnston
> Subject: Re: FW: [GENERAL] SQL rolling window without aggregation > > Huang, Suya wrote > > It seems like it's not been sent to the SQL group, so I'm trying with > > this group. > > Asked and answered...online archives follow > > > http://postgre

Re: FW: [GENERAL] SQL rolling window without aggregation

2014-12-08 Thread Huang, Suya
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of David G Johnston Sent: Monday, December 08, 2014 1:18 PM To: pgsql-general@postgresql.org Subject: Re: FW: [GENERAL] SQL rolling window without aggregation Huang, Suya

Re: FW: [GENERAL] SQL rolling window without aggregation

2014-12-07 Thread David G Johnston
928965-5829345.p...@n5.nabble.com David J. -- View this message in context: http://postgresql.nabble.com/FW-GENERAL-SQL-rolling-window-without-aggregation-tp5829528p5829564.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing lis

Re: FW: [GENERAL] SQL rolling window without aggregation

2014-12-07 Thread AJ Welch
I believe this can be accomplished with lead() and union: http://sqlfiddle.com/#!15/521d5/7 Thanks, AJ https://www.linkedin.com/in/ajw0100 On Sun, Dec 7, 2014 at 3:13 PM, Huang, Suya wrote: > It seems like it’s not been sent to the SQL group, so I’m trying with > this group. > > > > Thanks, >

FW: [GENERAL] SQL rolling window without aggregation

2014-12-07 Thread Huang, Suya
It seems like it's not been sent to the SQL group, so I'm trying with this group. Thanks, Suya From: Huang, Suya Sent: Friday, December 05, 2014 6:25 PM To: 'pgsql-...@postgresql.org' Subject: [SQL] rolling window without aggregation Hi SQL experts, I've got a question here, is that possible t

Re: [GENERAL] SQL functions and triggers?

2014-11-25 Thread Alban Hertroys
> On 25 Nov 2014, at 22:24, Tom Lane wrote: > > Alban Hertroys writes: >> In the past, when writing trigger functions, I’ve always used pl/pgsql >> without giving it a second thought. Today I was modifying a database >> creation script that was originally intended for Firebird to work with >

Re: [GENERAL] SQL functions and triggers?

2014-11-25 Thread Tom Lane
Alban Hertroys writes: > In the past, when writing trigger functions, I’ve always used pl/pgsql > without giving it a second thought. Today I was modifying a database creation > script that was originally intended for Firebird to work with Postgres and > the example trigger procedures in ther

Re: [GENERAL] SQL functions and triggers?

2014-11-25 Thread Bill Moran
On Tue, 25 Nov 2014 21:41:12 +0100 Alban Hertroys wrote: > Hi all, > > In the past, when writing trigger functions, I?ve always used pl/pgsql > without giving it a second thought. Today I was modifying a database creation > script that was originally intended for Firebird to work with Postgres

[GENERAL] SQL functions and triggers?

2014-11-25 Thread Alban Hertroys
Hi all, In the past, when writing trigger functions, I’ve always used pl/pgsql without giving it a second thought. Today I was modifying a database creation script that was originally intended for Firebird to work with Postgres and the example trigger procedures in there were very close to pure

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-30 Thread Dev Kumkar
On Tue, Sep 30, 2014 at 8:50 PM, Alvaro Herrera wrote: > Did you try decreasing the autovacuum_multixact_freeze_min_age and > autovacuum_multixact_freeze_table_age parameters? > As per the docs this set anywhere from zero to 1 billion for vacuum_multixact_freeze_min_age And zero to 2 billion for

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-30 Thread Alvaro Herrera
Dev Kumkar wrote: > On Fri, Sep 26, 2014 at 1:36 PM, Dev Kumkar wrote: > > > Received the database with huge pg_multixact directory of size 21G and > > there are ~82,000 files in "pg_multixact/members" and 202 files in > > "pg_multixact/offsets" directory. > > > > Did run "vacuum full" on this da

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-30 Thread Dev Kumkar
On Fri, Sep 26, 2014 at 1:36 PM, Dev Kumkar wrote: > Received the database with huge pg_multixact directory of size 21G and > there are ~82,000 files in "pg_multixact/members" and 202 files in > "pg_multixact/offsets" directory. > > Did run "vacuum full" on this database and it was successful. Ho

Re: [GENERAL] [SQL] how to see "where" SQL is better than PLPGSQL

2014-09-28 Thread Pavel Stehule
2014-09-28 21:29 GMT+02:00 Gerardo Herzig : > > Hi all. I see an entire database, with all the stored procedures > > writen in plpgsql. Off course, many (if not all) of that SP are > > simple inserts, updates, selects and so on. > > > > So, i want to test and show the differences between doing the

Re: [GENERAL] [SQL] how to see "where" SQL is better than PLPGSQL

2014-09-28 Thread Gerardo Herzig
> Hi all. I see an entire database, with all the stored procedures > writen in plpgsql. Off course, many (if not all) of that SP are > simple inserts, updates, selects and so on. > > So, i want to test and show the differences between doing the same > function in pgpgsql vs. plain sql. > Im gettin

Re: [GENERAL] [SQL] how to see "where" SQL is better than PLPGSQL

2014-09-28 Thread Pavel Stehule
2014-09-28 20:30 GMT+02:00 Gerardo Herzig : > Hi all. I see an entire database, with all the stored procedures writen in > plpgsql. Off course, many (if not all) of that SP are simple inserts, > updates, selects and so on. > > So, i want to test and show the differences between doing the same > fu

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-26 Thread Dev Kumkar
On Fri, Sep 19, 2014 at 1:23 PM, Dev Kumkar wrote: > Apologies for the delay, was working/troubleshooting same issue and was > away from my emails. :( > Regards... > Received the database with huge pg_multixact directory of size 21G and there are ~82,000 files in "pg_multixact/members" and 202 f

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-19 Thread Dev Kumkar
On Fri, Sep 19, 2014 at 1:03 PM, Andres Freund wrote: > Yes: Learning some patience. You'd given the previous answer two hours > before this one. Nobody is paid to work on this list... Apologies for the delay, was working/troubleshooting same issue and was away from my emails. :( Regards...

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-19 Thread Dev Kumkar
On Fri, Sep 19, 2014 at 8:07 AM, Alvaro Herrera wrote: > Can you paste the pg_controldata output please? > pg_controldata output as follows: pg_control version number:937 Catalog version number: 201306121 Database system identifier: 6023658189132429183 Databa

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-19 Thread Andres Freund
On 2014-09-18 22:52:57 +0530, Dev Kumkar wrote: > On Thu, Sep 18, 2014 at 6:20 PM, Dev Kumkar wrote: > > > On Thu, Sep 18, 2014 at 4:03 PM, Andres Freund > > wrote: > > > >> I don't think that's relevant for you. > >> > >> Did you upgrade the database using pg_upgrade? > >> > > > > That's correc

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-18 Thread Alvaro Herrera
Dev Kumkar wrote: > On Thu, Sep 18, 2014 at 4:03 PM, Andres Freund > wrote: > > Can you show pg_controldata output and the output of 'SELECT oid, > > datname, relfrozenxid, age(relfrozenxid), relminmxid FROM pg_database;'? > > > > Here are the details: > oid datname datfrozenxidag

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-18 Thread Adrian Klaver
On 09/18/2014 10:22 AM, Dev Kumkar wrote: On Thu, Sep 18, 2014 at 6:20 PM, Dev Kumkar mailto:devdas.kum...@gmail.com>> wrote: On Thu, Sep 18, 2014 at 4:03 PM, Andres Freund mailto:and...@2ndquadrant.com>> wrote: I don't think that's relevant for you. Did you upgrade the

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-18 Thread Dev Kumkar
On Thu, Sep 18, 2014 at 6:20 PM, Dev Kumkar wrote: > On Thu, Sep 18, 2014 at 4:03 PM, Andres Freund > wrote: > >> I don't think that's relevant for you. >> >> Did you upgrade the database using pg_upgrade? >> > > That's correct! No, there is no upgrade here. > > >> Can you show pg_controldata ou

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-18 Thread Dev Kumkar
On Thu, Sep 18, 2014 at 4:03 PM, Andres Freund wrote: > I don't think that's relevant for you. > > Did you upgrade the database using pg_upgrade? > That's correct! No, there is no upgrade here. > Can you show pg_controldata output and the output of 'SELECT oid, > datname, relfrozenxid, age(rel

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-18 Thread Andres Freund
On 2014-09-18 14:41:07 +0530, Dev Kumkar wrote: > On Thu, Sep 18, 2014 at 2:41 AM, Adrian Klaver > wrote: > > > > > Aaah, hit enter too soon. Also see the other changes under Changes that > > apply to multixact in 9.3.5 > > > Thanks for sharing same. Found this one interesting "Truncate pg_mult

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-18 Thread Dev Kumkar
On Thu, Sep 18, 2014 at 2:41 AM, Adrian Klaver wrote: > > Aaah, hit enter too soon. Also see the other changes under Changes that > apply to multixact in 9.3.5 Thanks for sharing same. Found this one interesting "Truncate pg_multixact during checkpoints, not during VACUUM (Álvaro Herrera)" and

Re: [GENERAL] [SQL] pg_multixact issues

2014-09-17 Thread Adrian Klaver
On 09/17/2014 01:36 PM, Dev Kumkar wrote: On Wed, Sep 17, 2014 at 7:20 PM, Dev Kumkar mailto:devdas.kum...@gmail.com>> wrote: On Wed, Sep 17, 2014 at 6:51 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: http://www.postgresql.org/__docs/9.3/static/routine-__vacuumin

  1   2   3   4   5   6   7   8   9   10   >