Re: PLPGSQL: DECLARE more variable with same type at once

2020-03-25 Thread Pavel Stehule
st 25. 3. 2020 v 13:53 odesílatel Durumdara napsal: > Hello! > > I want to ask how to shortening code? > > Delta double precision; > UjErtek double precision; > UjDErtek double precision; > > For example - but this makes an error: > Delta, UjErtek, UjDErtek double precision; > > D

Re: Is PostgreSQL SQL Database Command Syntax Similar to MySQL/MariaDB?

2020-03-30 Thread Pavel Stehule
po 30. 3. 2020 v 14:49 odesílatel Turritopsis Dohrnii Teo En Ming < c...@teo-en-ming.com> napsal: > Good evening from Singapore, > > Is PostgreSQL SQL database command syntax similar to MySQL/MariaDB? > > Because I have never used PostgreSQL before. > > I am looking forward to hearing from you soo

Re: Is PostgreSQL SQL Database Command Syntax Similar to MySQL/MariaDB?

2020-03-30 Thread Pavel Stehule
po 30. 3. 2020 v 15:06 odesílatel Turritopsis Dohrnii Teo En Ming < c...@teo-en-ming.com> napsal: > On 2020-03-30 21:03, Pavel Stehule wrote: > > po 30. 3. 2020 v 14:49 odesílatel Turritopsis Dohrnii Teo En Ming > > napsal: > > > >> Good evening from Si

Re: How to unnest nested arrays

2020-04-06 Thread Pavel Stehule
út 7. 4. 2020 v 4:44 odesílatel David G. Johnston < david.g.johns...@gmail.com> napsal: > On Mon, Apr 6, 2020 at 6:12 PM Guyren Howe wrote: > >> Consider this: >> >> *select* (*array*[*array*[1, 2], *array*[3, 4]])[i:i] >> *from* *generate_subscripts*(*array*[*array*[1, 2], *array*[3, 4]], 1) i >

Re: How to unnest nested arrays

2020-04-06 Thread Pavel Stehule
út 7. 4. 2020 v 7:25 odesílatel Guyren Howe napsal: > > > On Apr 6, 2020, at 19:44 , David G. Johnston > wrote: > > On Mon, Apr 6, 2020 at 6:12 PM Guyren Howe wrote: > >> Consider this: >> >> *select* (*array*[*array*[1, 2], *array*[3, 4]])[i:i] >> *from* *generate_subscripts*(*array*[*array*[1

Re: Performance degradation if query returns no rows and column expression is used after upgrading to 12

2020-04-07 Thread Pavel Stehule
út 7. 4. 2020 v 18:47 odesílatel Andrus napsal: > Hi! > > Query returns no rows but its execution time in Postgres 12 depends on the > column expression. > > Query with column expression > > coalesce( (select sum(taitmata) from rid join dok using (dokumnr) > where toode=toode.toode and doktyyp='

Re: Performance degradation if query returns no rows and column expression is used after upgrading to 12

2020-04-07 Thread Pavel Stehule
út 7. 4. 2020 v 19:09 odesílatel Andrus napsal: > Hi! > >on your query there is too slow JIT. Is strange how much. So the best way > is disable JIT probably > >set jit to off; > >or same field in postgresql.conf > > Thank you. > > set jit to off > > makes select fast. > I have encountered this is

Re: Performance degradation if query returns no rows and column expression is used after upgrading to 12

2020-04-08 Thread Pavel Stehule
Hi út 7. 4. 2020 v 23:56 odesílatel Andrus napsal: > Hi! > > >It is really strange why it is too slow. Can you prepare test case? Looks > like bug (maybe not Postgres's bug) > > Testcase is below. > With jit on it takes 3.3 sec and with jit off 1.5 sec. > > Andrus. > > create temp table toode

Re: Performance degradation if query returns no rows and column expression is used after upgrading to 12

2020-04-08 Thread Pavel Stehule
st 8. 4. 2020 v 15:34 odesílatel Andrus napsal: > Hi > > >this query is little bit strange - it has pretty big cost, and because > returns nothing, then it's pretty fast against cost. > >there is 18 subqueries, but jit_above_cost is ralated just to one query. > This is probably worst case for JIT

Re: Help needed with XMLTABLE

2020-04-15 Thread Pavel Stehule
st 15. 4. 2020 v 7:32 odesílatel Dilip Kumar napsal: > One of our customers tried to use XMLTABLE syntax without > row_expression, which works fine with ORACLE but doesn't work with > PostgreSQL. So can anyone suggest what alternative we can use? > > CREATE TABLE user_pool_clean ( > fk_user_

Re: Help needed with XMLTABLE

2020-04-15 Thread Pavel Stehule
st 15. 4. 2020 v 7:32 odesílatel Dilip Kumar napsal: > One of our customers tried to use XMLTABLE syntax without > row_expression, which works fine with ORACLE but doesn't work with > PostgreSQL. So can anyone suggest what alternative we can use? > > CREATE TABLE user_pool_clean ( > fk_user_

Re: timestamp and timestamptz

2020-04-16 Thread Pavel Stehule
čt 16. 4. 2020 v 9:19 odesílatel raf napsal: > David G. Johnston wrote: > > > On Wed, Apr 15, 2020 at 4:53 PM raf wrote: > > > > > I don't see much difference in storing a timestamptz in UTC or a > > > timestamptz > > > in CET. As long as the intended offset from UTC is recorded (which it > is >

Re: possibilities for SQL optimization

2020-04-16 Thread Pavel Stehule
čt 16. 4. 2020 v 16:08 odesílatel Chris Stephens napsal: > PG12 > RHEL 8 > > I suspect there's little I can do to get the following query to run > faster/more efficiently but thought I'd post to list and confirm. > > Caveat: I'm coming from an Oracle background and am extremely wet behind > ears

Re: script libraries?

2020-04-30 Thread Pavel Stehule
čt 30. 4. 2020 v 15:54 odesílatel Chris Stephens napsal: > as another Oracle DBA trying to pick up Postgresql one thing i haven't > come across are script libraries such as there are for Oracle ( > https://github.com/tanelpoder/tpt-oracle and > https://oracle-base.com/dba/scripts as examples). >

Re: Q: Comparing PostgreSQL and Oracle

2020-05-20 Thread Pavel Stehule
st 20. 5. 2020 v 9:34 odesílatel Alfonso napsal: > Hi colleagues. > > > I'm working in a Java application with some colleagues and we are in > doubt wether to use Oracle or PostgreSQL as the data store. It will be a > OLTP mainly application. > > Beside of license terms/costs which is a clear po

Re: Trigger not firing

2020-06-01 Thread Pavel Stehule
po 1. 6. 2020 v 12:09 odesílatel Hans napsal: > >> I've had a weird problem in a production system. The customer had > >> installed a new server with our software on it. The software installs > >> a Postgres database schema that includes a number of triggers. The > >> triggers perform inserts int

Re: Changing from security definer to security invoker without dropping ?

2020-06-11 Thread Pavel Stehule
Hi čt 11. 6. 2020 v 9:29 odesílatel Laura Smith < n5d9xq3ti233xiyif...@protonmail.ch> napsal: > Hi, > > Just curious if there is a way to switch a function from definer to > invoker without dropping ? > create function foo(a int) returns int as $$ begin return $1; end $$ language plpgsql; postg

Re: Changing from security definer to security invoker without dropping ?

2020-06-11 Thread Pavel Stehule
čt 11. 6. 2020 v 9:51 odesílatel Laura Smith < n5d9xq3ti233xiyif...@protonmail.ch> napsal: > > > > Sent with ProtonMail <https://protonmail.com> Secure Email. > > ‐‐‐ Original Message ‐‐‐ > On Thursday, 11 June 2020 08:39, Pavel Stehule > wro

Re: timestamp - timestamp result

2020-06-25 Thread Pavel Stehule
pá 26. 6. 2020 v 7:29 odesílatel Thomas Kellerer napsal: > I regularly see people suggesting to use > > extract(day from one_timestamp - other_timestamp) > > to calculate the difference between two timestamps in days. > > But I wonder if the "format" of the resulting interval is guaranteed to

Re: Errors after cloning OS to new disk under Hyper-V

2020-07-17 Thread Pavel Stehule
so 18. 7. 2020 v 6:36 odesílatel napsal: > -Original Message- > From: Rob Sargent > Sent: Saturday, July 18, 2020 5:56 AM > To: pgsql-general@lists.postgresql.org > Subject: Re: Errors after cloning OS to new disk under Hyper-V > > > Have you tried to REINDEX as suggested? > > I cannot g

Re: Row estimates for empty tables

2020-07-24 Thread Pavel Stehule
pá 24. 7. 2020 v 16:38 odesílatel Christophe Pettus napsal: > > > > On Jul 24, 2020, at 06:48, Tom Lane wrote: > > > > There's certainly not a lot besides tradition to justify the exact > > numbers used in this case. > > Since we already special-case parent tables for partition sets, would a > s

Re: is JIT available

2020-07-24 Thread Pavel Stehule
so 25. 7. 2020 v 0:49 odesílatel Scott Ribe napsal: > So JIT is enabled in your conf, how can you tell from within a client > session whether it's actually available (PG compiled with it and compiler > available)? > > (In the other discussion I started, doing a dump and import of just the > table

Re: is JIT available

2020-07-25 Thread Pavel Stehule
so 25. 7. 2020 v 14:04 odesílatel Scott Ribe napsal: > > On Jul 24, 2020, at 9:55 PM, Pavel Stehule > wrote: > > > > SELECT * FROM pg_config; > > That doesn't tell me whether or not it can actually be used. > It shows if Postgres was compiled with JIT sup

Re: is JIT available

2020-07-25 Thread Pavel Stehule
so 25. 7. 2020 v 14:33 odesílatel Scott Ribe napsal: > > On Jul 25, 2020, at 6:21 AM, Pavel Stehule > wrote: > > > > It shows if Postgres was compiled with JIT support. > > > > When you run EXPLAIN ANALYZE SELECT ... then you can see info about JIT > overhead

Re: How to find out why user processes are using so much memory?

2020-07-30 Thread Pavel Stehule
Hi čt 30. 7. 2020 v 12:33 odesílatel Zwettler Markus (OIZ) < markus.zwett...@zuerich.ch> napsal: > Hi, > > Having an application on Postgres. > Most parameters are on default. > Memory related parameters are slightly increased: > effective_cache_size = 512MB > max_connections = 300 > maintenance_

Re: Track pgsql steps

2020-08-05 Thread Pavel Stehule
Hi st 29. 7. 2020 v 19:55 odesílatel Olivier Leprêtre napsal: > Hi, > > > > I have a rather long pgsql procedure and I would like to detect which step > is currently executing (subscript 1,2,3…). Due to transaction isolation, > it’s not possible to make it write in a table or get nexval from a s

Re: ERROR: canceling statement due to user request

2020-08-05 Thread Pavel Stehule
st 5. 8. 2020 v 11:35 odesílatel FOUTE K. Jaurès napsal: > Hello, > > How can I Solve this error ? > > ERROR: canceling statement due to user request > You cannot handle this exception. What is a problem with it? It is normal situation - statement was cancelled. Regards Pavel > Best Regard

Re: ERROR: canceling statement due to user request

2020-08-05 Thread Pavel Stehule
st 5. 8. 2020 v 12:07 odesílatel Paul Förster napsal: > Hi Jaurès, > > > On 05. Aug, 2020, at 11:35, FOUTE K. Jaurès > wrote: > > > > Hello, > > > > How can I Solve this error ? > > > > ERROR: canceling statement due to user request > > simple: don't make the user hit ctrl-c or otherwise interr

Re: ERROR: canceling statement due to user request

2020-08-05 Thread Pavel Stehule
st 5. 8. 2020 v 12:51 odesílatel FOUTE K. Jaurès napsal: > Ok, > Just want if we can avoid this error message, With some config for exemple > ? > it is not possible Pavel > > Le mer. 5 août 2020 à 11:07, Paul Förster a > écrit : > >> Hi Jaurès, >> >> > On 05. Aug, 2020, at 11:35, FOUTE K. Jau

Re: Implement a new data type

2020-08-11 Thread Pavel Stehule
Hi út 11. 8. 2020 v 13:31 odesílatel mohand oubelkacem makhoukhene < mohand-oubelka...@outlook.com> napsal: > Hello; > I whould like to implement a new data type next to char, number, > varchar... A Money type. > So i'll have to change the source code, but i don't know which fonctions i > need to

Re: How to export query results to excel file using psql command in postgresql

2020-08-13 Thread Pavel Stehule
Hi čt 13. 8. 2020 v 16:10 odesílatel Naveen Kumar napsal: > How to export query results to excel file using psql command in postgresql > Excel can import csv file so you can for Postgres 12 \pset format csv \o path_to_file select * from ... or for older postgres \copy (select * from ...) t

Re: bug in psql?

2020-08-14 Thread Pavel Stehule
so 15. 8. 2020 v 7:35 odesílatel Aleksey M Boltenkov napsal: > Is this a bug? > > Executing of malformed (quote symbols) select in psql results in > unexpected behaviour: > > pg01:5432 postgres@db=# select 'any expression'any expression\d+; > List of relations > Schema │ Name │ Type │ Owner │ Siz

Re: bug in psql?

2020-08-14 Thread Pavel Stehule
so 15. 8. 2020 v 8:35 odesílatel Aleksey M Boltenkov napsal: > eksey M Boltenkov. > > 15.08.2020, 08:39, Pavel Stehule > > > so 15. 8. 2020 v 7:35 odesílatel Aleksey M Boltenkov > napsal: > >> Is this a bug? >> >> Executing of malformed (quote symbol

Re: Stored procedure with execute and returning clause

2020-08-23 Thread Pavel Stehule
ne 23. 8. 2020 v 14:36 odesílatel Mike Martin napsal: > > Hi > I am having difficulty with returning clause and stored procedure. This is > an (edited) example of where I am > > CREATE OR REPLACE PROCEDURE public.arrcopy1( > dataarr anyarray, > tblname text, > cols text DEFAULT NUL

Re: Calling a SQL function inside a C function

2020-08-26 Thread Pavel Stehule
Hi čt 27. 8. 2020 v 0:43 odesílatel Eric Zhu napsal: > How do I call a function defined using CREATE FUNCTION in SQL inside a C > function in an extension? I feel this should be possible as the query > parser is able to resolve the function names and arguments in a raw string > query. I want to

Re: Postgres DB hacked.

2020-08-30 Thread Pavel Stehule
po 31. 8. 2020 v 6:58 odesílatel Yogesh Sharma napsal: > Dear All, > Thanks for your support. > > We faced the below issue and our all DB backup data has lost. > > It seems Hacker deleted all the tables in the DB and created a single > table called "warning". when I am trying to select this tabl

Re: How bad is using queries with thousands of values for operators IN or ANY?

2020-08-31 Thread Pavel Stehule
po 31. 8. 2020 v 10:04 odesílatel Thorsten Schöning napsal: > Hi all, > > I have lots of queries in which I need to restrict access to rows > using some decimal row-ID and am mostly doing so with using the > operator IN in WHERE-clauses. Additionally I'm mostly embedding the > IDs as ","-seperate

Re: How bad is using queries with thousands of values for operators IN or ANY?

2020-08-31 Thread Pavel Stehule
po 31. 8. 2020 v 13:29 odesílatel Thomas Kellerer napsal: > Thorsten Schöning schrieb am 31.08.2020 um 12:37: > > So for what query size or number of IDs to compare in IN would you > > consider a different approach at all? > > > In my experience "hundreds" of IDs tend to be quite slow if used wit

Re: How bad is using queries with thousands of values for operators IN or ANY?

2020-09-01 Thread Pavel Stehule
út 1. 9. 2020 v 9:22 odesílatel Kyotaro Horiguchi napsal: > At Mon, 31 Aug 2020 16:04:43 +0200, Pavel Stehule > wrote in > > po 31. 8. 2020 v 13:29 odesílatel Thomas Kellerer > napsal: > > > > > Thorsten Schöning schrieb am 31.08.2020 um 12:37: > > > &g

Re: Autovacuum of independent tables

2020-09-08 Thread Pavel Stehule
Hi út 8. 9. 2020 v 9:32 odesílatel Michael Holzman napsal: > Hi, > > I have two applications A and B. A runs SELECT statements only and only on > tableA. B actively updates tableB, A never looks into tableB. B has nothing > to do with tableA. > > Still, if A is inside a long running transaction,

Re: Autovacuum of independent tables

2020-09-08 Thread Pavel Stehule
út 8. 9. 2020 v 10:42 odesílatel Michael Holzman napsal: > > > On Tue, Sep 8, 2020 at 11:28 AM Michael Paquier wrote: > >> >> This is called MVCC, which applies to a session as a whole. The point >> here is that even if your application knows that only tableA is used >> by a given transaction, P

Re: Oracle Associate Array conversion to PostgreSQL

2020-09-09 Thread Pavel Stehule
Hi čt 10. 9. 2020 v 7:12 odesílatel JAGMOHAN KAINTURA < jagmohan.kaint...@gmail.com> napsal: > Hi All, > > Since we don't have the support of Associative arrays in Postgres, we need > to convert Oracle associative arrays with a different approach in > PostgreSQL. > > Following is a sample piece o

Re: Problems with MemoryContextSwitchTo ()

2020-09-16 Thread Pavel Stehule
st 16. 9. 2020 v 13:32 odesílatel Yessica Brinkmann < brinkmann.yess...@gmail.com> napsal: > Good Morning. > I will greatly appreciate a help please on this subject. I actually did > several tests already and tried a lot to fix it myself. But I am not able > to. And I really need to know this in o

Re: Problems with MemoryContextSwitchTo ()

2020-09-16 Thread Pavel Stehule
How you get this list? It is result of SPI_exec*** ? There is SPI_finish(), that cleaning a memory used by SPI interface, and theoretically it can clean result of previous query. Regards Pavel > > Mensaje original > Asunto: Re: Problems with MemoryContextSwitchTo ()

Re: Problems with MemoryContextSwitchTo ()

2020-09-16 Thread Pavel Stehule
x some issue without access to code Best regards, > Yessica Brinkmann > > El mié., 16 sept. 2020 a las 9:16, Pavel Stehule () > escribió: > >> >> >> st 16. 9. 2020 v 15:09 odesílatel Yessica Brinkmann < >> brinkmann.yess...@gmail.com> napsal: >

Re: Problems with MemoryContextSwitchTo ()

2020-09-16 Thread Pavel Stehule
čt 17. 9. 2020 v 6:09 odesílatel Pavel Stehule napsal: > > > čt 17. 9. 2020 v 3:16 odesílatel Yessica Brinkmann < > brinkmann.yess...@gmail.com> napsal: > >> Good night, >> Thank you very much for the answer. >> Excuse me please just answered, I was at m

Re: Problems with MemoryContextSwitchTo ()

2020-09-17 Thread Pavel Stehule
o work and study as well, so right now >>> I can't see the answers in detail. >>> Best regards, >>> Yessica Brinkmann. >>> >>> >>> Mensaje original >>> Asunto: Re: Problems with MemoryContextSwitchTo () >&g

Re: PostgreSQL on Windows' state

2020-09-23 Thread Pavel Stehule
st 23. 9. 2020 v 10:38 odesílatel Alessandro Dentella < sandro.dente...@gmail.com> napsal: > > Hi, > > disclaimer: I've never been a Windows user and I send this email just on > behalf > of a friend that has problems convincing his team to use PostgreSQL. > > I'd like to understand if what the tea

Re: Postgres going very slow

2020-09-30 Thread Pavel Stehule
st 30. 9. 2020 v 10:06 odesílatel Olivier Leprêtre napsal: > Hi, > > > > > > We have a database which is getting very slow. Pgadmin 3 is alos very > slow, requiring more than 2 minutes to refresh the list of schemas > > Machine is a windows server 2016 with Intel Xeon 2,4Ghz, 24 Go Ram. > Postgre

Re: What version specification used by PG community developers?

2020-10-07 Thread Pavel Stehule
st 7. 10. 2020 v 9:52 odesílatel WanCheng napsal: > Is same to the SemVer?(https://semver.org/) > no https://www.postgresql.org/support/versioning/ Regards Pavel

Re: Parameter value from (mb/gb) to bytes

2020-10-14 Thread Pavel Stehule
st 14. 10. 2020 v 17:10 odesílatel Tom Lane napsal: > Magnus Hagander writes: > > On Wed, Oct 14, 2020 at 3:57 PM Thomas Kellerer wrote: > >> select pg_size_bytes(setting) * 8192 > >> from pg_settings > >> where name = 'shared_buffers'; > > > Actually, it doesn't have to be in 8k pages, that de

Re: Need to trace the logs

2020-10-15 Thread Pavel Stehule
čt 15. 10. 2020 v 15:51 odesílatel hubert depesz lubaczewski < dep...@depesz.com> napsal: > On Thu, Oct 15, 2020 at 05:25:11PM +0530, nandha kumar wrote: > > Hi Team, > > We are using a postgresql database with 9.6.1 version, any way to > > trace the last modified object, procedure in Postgre

Re: print formated special characteres

2020-10-18 Thread Pavel Stehule
po 19. 10. 2020 v 3:18 odesílatel Celso Lorenzetti napsal: > Hi Peter, > > is language C standart.. > > On 2020-10-17 20:51:36 +0200, Matthias Apitz wrote: > > El día sábado, octubre 17, 2020 a las 03:37:46p. m. -0300, Celso > Lorenzetti escribió: > > > > > Somebody help me, please. > > > > > > H

Re: Attaching database

2020-10-19 Thread Pavel Stehule
Hi po 19. 10. 2020 v 19:40 odesílatel Igor Korot napsal: > Hi, > IIUC, PostgreSQL does not support attaching a database to an existing > connection. > However I was told that I can use this: > https://www.postgresql.org/docs/9.3/postgres-fdw.html. > > Is it the same thing? Why there is no simple

Re: Attaching database

2020-10-19 Thread Pavel Stehule
po 19. 10. 2020 v 20:18 odesílatel Igor Korot napsal: > Hi, Pavel, > > On Mon, Oct 19, 2020 at 12:51 PM Pavel Stehule > wrote: > > > > Hi > > > > po 19. 10. 2020 v 19:40 odesílatel Igor Korot > napsal: > >> > >> Hi, > >> IIU

Re: Temporary tables usage in functions

2020-11-09 Thread Pavel Stehule
Hi po 9. 11. 2020 v 13:07 odesílatel Yambu napsal: > Hi > > May I know if a temporary table is dropped at the end of a function? > PostgreSQL temporary tables can be dropped on the end of transaction or end of session. > > Also may I know if excessive use of temporary tables may cause locks?

Re: RAISE INFO in function

2020-11-09 Thread Pavel Stehule
po 9. 11. 2020 v 14:46 odesílatel Yambu napsal: > Hi > > May i know if RAISE INFO impacts performance significantly in a function? > > Should i comment them out once i'm done using/debugging ? > It depends on more factors - but expressions in RAISE statements are calculated every time and someti

Re: Temporary tables usage in functions

2020-11-09 Thread Pavel Stehule
po 9. 11. 2020 v 18:19 odesílatel Michael Lewis napsal: > Also may I know if excessive use of temporary tables may cause locks? >>> >> >> Usually there are no problems with locks, but there is a problem with >> system tables bloating. Creating and dropping temp tables is expensive like >> creatin

Re: Execution plan does not use index

2020-11-09 Thread Pavel Stehule
út 10. 11. 2020 v 8:18 odesílatel Peter Coppens napsal: > Michael > > Many thanks for spending your time on this. Your alternative does not help > unfortunately (see execution plan) > > Still a sequential scan on the complete table. I have tried many > alternatives and somehow whenever I add a co

Re: Check constraints do not seem to be working!!!

2020-11-11 Thread Pavel Stehule
st 11. 11. 2020 v 9:38 odesílatel Chris Sterritt napsal: > > On 11/11/2020 06:44, Jitendra Loyal wrote: > > Consider this table definition: > create table t ( i serial, b bool, c bool, > constraint b_c check ( (b = true and c is > not null ) or (b is disti

Re: Packages?

2020-11-12 Thread Pavel Stehule
Hi pá 13. 11. 2020 v 8:29 odesílatel Post Gresql napsal: > Hi, > > Is there chance we will get packages (like those in Oracle) in PostgreSQL? > This probability is very low - Postgres has redundant feature - schema. Schema (in Postgres) can be used like Oracle's packages. Orafce uses schemas i

Re: Set COLLATE on a session level

2020-11-20 Thread Pavel Stehule
Hi pá 20. 11. 2020 v 15:28 odesílatel Dirk Mika napsal: > Thank you for the quick reply. But how is this usually solved? > > Let's assume there is an app that accesses the same database from > different countries. And in this app data should be displayed ordered. And > the sort order is not iden

Re: Migration from SQL Server to PostgeSQL

2020-11-29 Thread Pavel Stehule
po 30. 11. 2020 v 6:12 odesílatel Muthukumar.GK napsal: > HiTeam, > > We need to migrate tables,Records,Procedure and function from SQL server > to Postgresql. Kindly let me know, Is there any tool or easiest way > available to migrate from SQL Server to Postgresql. Please let me know if > there

Re: Migration from SQL Server to PostgeSQL

2020-11-29 Thread Pavel Stehule
Regards > Muthu > > On Mon, Nov 30, 2020 at 11:02 AM Pavel Stehule > wrote: > >> >> >> po 30. 11. 2020 v 6:12 odesílatel Muthukumar.GK >> napsal: >> >>> HiTeam, >>> >>> We need to migrate tables,Records,Procedure and functi

Re: Calling Procedure from another procedure in Postgres

2020-12-02 Thread Pavel Stehule
st 2. 12. 2020 v 11:20 odesílatel Muthukumar.GK napsal: > Hi team, > > I need to call the procedure(not function) and insert the records into a > temporary table from another procedure in postgres. When executing the > procedure 'Sampleproc2',I got some below syntax error. Kindly let me know > w

Re: Postgres C-API: How to get the Oid for a custom type defined in a schema outside of the current search path

2020-12-03 Thread Pavel Stehule
Hi čt 3. 12. 2020 v 10:32 odesílatel Michael Krüger napsal: > Dear all, > > I need to find out the Oid of a custom type in C programming language. > This type is defined in a schema, outside of the standard search path, e.g. > public. > I know that I can call TypenameGetTypid to find out an Oid.

Re: psql > split > queries & output

2020-12-03 Thread Pavel Stehule
čt 3. 12. 2020 v 12:39 odesílatel Wim Bertels napsal: > Hello, > > psql shows (the queries and) the output, > there are for example the -L option and echo_queries option > > is there a way to run psql so that: > * inside psql there are no surprises :) (ignore this line:) > * one pipe (or..) to a

Re: Postgres C-API: How to get the Oid for a custom type defined in a schema outside of the current search path

2020-12-03 Thread Pavel Stehule
čt 3. 12. 2020 v 11:44 odesílatel Michael Krüger napsal: > Hi, > > Am 03.12.2020 um 11:01 schrieb Pavel Stehule : > > Hi > > čt 3. 12. 2020 v 10:32 odesílatel Michael Krüger > napsal: > >> Dear all, >> >> I need to find out the Oid of a custom ty

Re: Raise exception without using plpgsql?

2020-12-17 Thread Pavel Stehule
čt 17. 12. 2020 v 17:45 odesílatel hubert depesz lubaczewski < dep...@depesz.com> napsal: > On Thu, Dec 17, 2020 at 03:32:09PM +0100, Joel Jacobson wrote: > > Hi, > > Is there a way to raise an exception with a message, > > without having to add your own plpgsql helper-function? > > Currently this

Re: plpgsql unit testing and code coverage

2020-12-31 Thread Pavel Stehule
čt 31. 12. 2020 v 13:21 odesílatel Joao Miguel Ferreira < joao.miguel.c.ferre...@gmail.com> napsal: > Hello, > > I'm a fan of unit testing and related matters but have used it only on > client applications, not on database implemented logic. I recently joined a > project whit dozens of PL function

Re: Avoid excessive inlining?

2021-01-02 Thread Pavel Stehule
Hi so 2. 1. 2021 v 20:07 odesílatel Joel Jacobson napsal: > I found yet another trick, which actually seems to be slightly faster than > the plpgsql version. > What version of Postgres do you use? plpgsql in Postgres 13 is significantly faster than on older versions Regards Pavel > The tri

Re: Avoid excessive inlining?

2021-01-02 Thread Pavel Stehule
so 2. 1. 2021 v 21:02 odesílatel Joel Jacobson napsal: > 13.1 > ok there is plpgsql most fast you can check if there are not some hidden implicit casting in your code. Regards Pavel > On Sat, Jan 2, 2021, at 20:37, Pavel Stehule wrote: > > Hi > > so 2. 1. 2021 v

Re: CROSSTAB( .. only one column has values... )

2021-01-05 Thread Pavel Stehule
Hi út 5. 1. 2021 v 19:45 odesílatel Joe Conway napsal: > On 1/5/21 12:11 PM, Tim Clarke wrote: > > imho the crosstab() function isn't a good implementation. The biggest > failure it > > has is that you must know exactly how many output columns you will have > in the > > result /_prior to running

Re: How to convert escaped text column - force E prefix

2021-01-06 Thread Pavel Stehule
Hi st 6. 1. 2021 v 8:55 odesílatel Durumdara napsal: > Dear Members! > > A web developer stores JSON like strings in a text column. > > With E prefix we can get the real text: > > Select E'Az ad\u00f3kulcsonk\u00e9nti' > > Hungarian: "Az adókulcsonkénti" (ISO-8859-2) > > How to get the same resu

Re: How to convert escaped text column - force E prefix

2021-01-06 Thread Pavel Stehule
st 6. 1. 2021 v 10:54 odesílatel Gavan Schneider napsal: > On 6 Jan 2021, at 19:43, Pavel Stehule wrote: > > Currently there are not any functions that you need. You need to write > your > own. > > CREATE OR REPLACE FUNCTION public.unistr(text) > RETURNS text > LAN

Re: CROSSTAB( .. only one column has values... )

2021-01-06 Thread Pavel Stehule
Hi st 6. 1. 2021 v 21:47 odesílatel Daniel Verite napsal: > Pavel Stehule wrote: > > > > *That* is a function of how Postgres set returning functions work, and > not > > > specific to crosstab(). It is not easily fixed. Patches to fix that >

Re: How to convert escaped text column - force E prefix

2021-01-07 Thread Pavel Stehule
čt 7. 1. 2021 v 12:13 odesílatel Durumdara napsal: > Dear Members! > > > > Pavel Stehule ezt írta (időpont: 2021. jan. 6., > Sze, 12:03): > >> >> >> >> it cannot work, because \ will be replaced by \\ >> >> postgres=# CREATE

Re: How to convert escaped text column - force E prefix

2021-01-07 Thread Pavel Stehule
čt 7. 1. 2021 v 15:50 odesílatel David G. Johnston < david.g.johns...@gmail.com> napsal: > On Thursday, January 7, 2021, Pavel Stehule > wrote: > >> >> >> The vulnerability is almost the same although it is a little bit harder >> to create attack strings.

Re: Finding memory corruption in an extension

2021-01-08 Thread Pavel Stehule
Hi pá 8. 1. 2021 v 18:48 odesílatel Jack Orenstein napsal: > An extension I'm creating is causing Postgres to crash, almost certainly > due to memory corruption. I am using palloc0/pfree, calling SET_VARSIZE, > and generally following the procedures documented here: > https://www.postgresql.org

Re: How to return a jsonb list of lists (with integers)

2021-02-17 Thread Pavel Stehule
Hi st 17. 2. 2021 v 11:40 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > I have tried the following, but IF FOUND is always false for some reason: > > _versus := JSONB_BUILD_ARRAY( > SUM(CASE WHEN (player1 = in_uid AND state1 = > 'won')

Re: How to return a jsonb list of lists (with integers)

2021-02-17 Thread Pavel Stehule
st 17. 2. 2021 v 15:34 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Hi Pavel, > > why would SELECT INTO be better here? > Minimally it doen't use undocumented feature. And you can be sure, so the query is evaluated really like a query. The expressions are evaluated differe

Re: How to return a jsonb list of lists (with integers)

2021-02-17 Thread Pavel Stehule
st 17. 2. 2021 v 16:02 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > I have tried switching to SELECT INTO, but IF FOUND is still always true, > which gives me [ null, null, null ] for some users: > > SELECT JSONB_BUILD_ARRAY( > SUM(CAS

Re: append jsonb array to another jsonb array

2021-02-17 Thread Pavel Stehule
Hi st 17. 2. 2021 v 20:44 odesílatel Joao Miguel Ferreira < joao.miguel.c.ferre...@gmail.com> napsal: > Hello all, > > I PL/pgSQL I have a few jsonb variables (instantiated each with an array > of objects) and I need to append them to produce the final result. All of > them are small in size (ma

Re: Syntax checking DO blocks and ALTER TABLE statements?

2021-02-18 Thread Pavel Stehule
pá 19. 2. 2021 v 6:09 odesílatel Kevin Brannen napsal: > >From: Ron > > > >How does one go about syntax checking this? > > > >do $$ > >begin if exists (select 1 from information_schema.table_constraints > >where constraint_name = 'error_to_web_service_error') then > > raise n

Re: converting text to bytea

2021-02-21 Thread Pavel Stehule
Hi po 22. 2. 2021 v 7:37 odesílatel Yambu napsal: > Hello > > This sounds simple, but im not getting the results when i cast text to > bytea like this first_name::bytea . Is there another way to do this? > You should to use convert_to function https://www.postgresql.org/docs/current/functions-

Re: Simple IN vs IN values performace

2021-02-23 Thread Pavel Stehule
Hi út 23. 2. 2021 v 10:36 odesílatel Alexander Voytsekhovskyy < young.in...@gmail.com> napsal: > Thanks for suggestion > > with tmp tables there are another issue - there are already 5-6 tables and > 2-3 IN filters. If i will replace them with tmp tables it may hit query > planner limits and it w

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 14:06 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Hello, revisiting an older mail on the too long deletion times (in > PostgreSQL 13.2)... > > I have followed the advices here, thank you - > > On Fri, Nov 27, 2020 at 4:15 PM Guillaume Lelarge > wrote: > >>

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 14:36 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Hi Pavel, > > trying to follow your advice "You should check so all foreign keys have an > index" I look at the table where I want to delete older records: > > # \d words_games >

Re: converting text to bytea

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 16:01 odesílatel Tom Lane napsal: > Yambu writes: > > Is there a reason why i'm getting text when i run the below > > select convert_to('some_text', 'UTF8')i get back 'some_text' > > You must have bytea_output set to "escape". > yes set bytea_output TO escape ; postgres=#

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
Hi čt 25. 2. 2021 v 19:39 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Pavel, thank you for asking! > > I have put the anonymized dump of my database at: > > http://wordsbyfarber.com/words_dev.sql.gz (beware, it is a 1.3 GB > download) > > The question is why does the comma

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 22:02 odesílatel Pavel Stehule napsal: > Hi > > čt 25. 2. 2021 v 19:39 odesílatel Alexander Farber < > alexander.far...@gmail.com> napsal: > >> Pavel, thank you for asking! >> >> I have put the anonymized dump of my database at: >>

Re: Deleting takes days, should I add some index?

2021-02-25 Thread Pavel Stehule
čt 25. 2. 2021 v 22:33 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Thank you, Pavel! > > I didn't even think about trying to "explain analyze" deletion of just 1 > record - > > On Thu, Feb 25, 2021 at 10:04 PM Pavel Stehule > wro

Re: Localizing stored functions by replacing placeholders in their body

2021-03-02 Thread Pavel Stehule
út 2. 3. 2021 v 17:18 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Or is it possible to call external commands from an sql script, like > > \i "sed 's/this/that/' some.sql" > you can use \! statement for execution of external statements Pavel

Re: Localizing stored functions by replacing placeholders in their body

2021-03-02 Thread Pavel Stehule
út 2. 3. 2021 v 17:55 odesílatel Alexander Farber < alexander.far...@gmail.com> napsal: > Thank you for the \! hint, Pavel, didn't know about that! > > Is it possible to have a pure SQL solution? (To avoid having to install > "sed" on my Win 10 PC) > You should to use PLpgSQL EXECUTE statement, n

Re: Couldn't cast to record[]

2022-03-03 Thread Pavel Stehule
Hi čt 3. 3. 2022 v 11:01 odesílatel Suresh Kumar R napsal: > Hi, I created an table with composite type array as datatype for one > column. > When I query that table I need the pg_typeof(column) as record[] instead of > composite_type[]. > I tried creating a separate function and returning recor

Re: PSQL bug?

2022-03-17 Thread Pavel Stehule
Hi čt 17. 3. 2022 v 11:35 odesílatel Dominique Devienne napsal: > Made a typo, using } instead of ) to test a weird table name, and got > disconnected. Normal? --DD > > ddevienne=> create table "t |" ( id int}; > ddevienne(> ); > server closed the connection unexpectedly > This probably

Re: Reg. GET STACKED DIAGNOSTICS values to be stored in a single variable

2022-04-07 Thread Pavel Stehule
Hi čt 7. 4. 2022 v 11:58 odesílatel Maheswaran R napsal: > Sir/madam, > While exception handling, we have to write multiple repeated lines in each > function to handle the GET STACKED DIAGNOSTICS values. it would be better > if all items in the diagnostics may be assigned to a single > variable/

Re: FOR integer loop bug?

2022-04-08 Thread Pavel Stehule
pá 8. 4. 2022 v 19:56 odesílatel Adrian Klaver napsal: > Postgres 14.2 > > In commenting on a SO question I came across the below. > > Given: > > CREATE OR REPLACE FUNCTION public.for_loop_test() > RETURNS void > LANGUAGE plpgsql > AS $function$ > BEGIN > FOR i IN 1..10 LOOP > R

Re: Question on cast string to date

2022-05-09 Thread Pavel Stehule
út 10. 5. 2022 v 6:28 odesílatel 正华吕 napsal: > Hi, > > I test the following SQL in pg15dev (seems same behavior as the > previous version). > > select '2020701'::date; > date > > 0202-07-01 >(1 row) > >At the first glance, the result seems quite strange. >

Re: Restricting user to see schema structure

2022-05-12 Thread Pavel Stehule
pá 13. 5. 2022 v 5:42 odesílatel Bryn Llewellyn napsal: > *david.g.johns...@gmail.com wrote:* > > *b...@yugabyte.com wrote:* > > However, the design decision that, way back when, leads to this outcome > does surprise me. The principle of least privilege insists that (in the > database regime) y

<    1   2   3   4   5   >