Re: An self-contained example "expanded" C data type

2021-11-04 Thread Pavel Stehule
Hi pá 5. 11. 2021 v 4:47 odesílatel Michel Pelletier < pelletier.mic...@gmail.com> napsal: > The docs for expanded data types are good, but for a working example you > have to go trolling through the array data type source code, which is > enlightening but a pretty heavy lift for me especially if

Re: Postgres Equivalent of Oracle Package

2021-11-16 Thread Pavel Stehule
Hi út 16. 11. 2021 v 18:23 odesílatel DAVID ROTH napsal: > One of the nice things about Oracle packages is that the code is loaded > and global values are set and stored only once per session. This is very > useful for values that are used repeatedly. > > What is the best way of emulating this b

Re: Postgres Equivalent of Oracle Package

2021-11-16 Thread Pavel Stehule
ackages. Have I > missed something? > There is nothing similar in Postgres. I am working session variables, that should be created in schema too. As workaround you can use GUC - configuration variables, that can be used for storing private values too. Regards Pavel > On 11/16/2021 12:27

Re: Execute command in PL/pgSQL function not executing

2021-11-18 Thread Pavel Stehule
alues_ct() line 15 at EXECUTE > > Please I would be very grateful for any hints as to what I could be doing > wrong. > This is not MS SQL - result of last query is not result of function. When you want to see result, you should to use RETURN statement - in this case RETURN QUERY EXECUTE, and your function should to return SETOF text instead VOID. Regards Pavel Stehule > > Regards > > >

Re: [EXT] Re: XQuery/XPath 2.0+ support

2021-11-30 Thread Pavel Stehule
Hi st 1. 12. 2021 v 6:28 odesílatel Garfield Lewis napsal: > Thx, Tom... > > But isn't the libxml2 library not sufficient for this purpose? Note that I > have not tried it yet, I am still just investigating possible solutions. > Unfortunately, no, or it is not about Postgres. The development of

Re: Query planner issue with preferring primary key over a better index when using ORDER BY and LIMIT

2021-12-06 Thread Pavel Stehule
po 6. 12. 2021 v 18:21 odesílatel Francisco Olarte napsal: > On Mon, 6 Dec 2021 at 18:03, Alan Hodgson > wrote: > ... > > The table has nearly 29 million records. 5069 of them match > shipment_import_id = 5090609. There is an index on shipment_import_id, > which the planner happily uses without

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-16 Thread Pavel Stehule
čt 16. 12. 2021 v 20:22 odesílatel Bryn Llewellyn napsal: > Folks who develop applications for Oracle Database have had the features > that the subject line of this email lists since the arrival of PL/SQL in > the early nineties. The advantages are self-evident to these programmers; > and their l

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-16 Thread Pavel Stehule
Hi pá 17. 12. 2021 v 3:39 odesílatel Mladen Gogala napsal: > On 12/16/21 16:48, Pavel Stehule wrote: > > I don't think Postgres needs packages - this is a redundant concept in > > Postgres, when Postgres has schemas (different from Oracle's schemas) > > and ext

Re: How to reduce query planning time (10s)

2021-12-20 Thread Pavel Stehule
Hi po 20. 12. 2021 v 13:31 odesílatel iulian dragos < iulian.dra...@databricks.com> napsal: > Hi, > > I was analyzing the query performance in a certain code path and noticed > that practically all of the query time is spent planning (11s planning, > 200ms execution time). Here is the output of E

Re: How to reduce query planning time (10s)

2021-12-20 Thread Pavel Stehule
> too much in this direction? > https://wiki.postgresql.org/wiki/Show_database_bloat Pavel > > iulian > > > On Mon, Dec 20, 2021 at 1:42 PM Pavel Stehule > wrote: > >> Hi >> >> po 20. 12. 2021 v 13:31 odesílatel iulian dragos < >> iulian.dra...@databr

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-20 Thread Pavel Stehule
Hi > I’m still hoping that I might get some pointers to whitepapers or blog > posts that expand on those bullets that I quoted from the PG doc: «Instead > of packages, use schemas to organize your functions into groups.» and > «Since there are no packages, there are no package-level variables eit

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-21 Thread Pavel Stehule
út 21. 12. 2021 v 19:28 odesílatel Bryn Llewellyn napsal: > *pavel.steh...@gmail.com wrote:* > > > *b...@yugabyte.com wrote:* > > I’m still hoping that I might get some pointers to whitepapers or blog > posts that expand on those bullets that I quoted from the PG doc: «Instead > of packages, us

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-21 Thread Pavel Stehule
út 21. 12. 2021 v 19:58 odesílatel Michael Lewis napsal: > On Tue, Dec 21, 2021 at 11:50 AM Pavel Stehule > wrote: > >> I wrote about it. Did you read this article? >> >> https://okbob.blogspot.com/2018/02/schema-variables.html >> >> The goals of this pro

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-22 Thread Pavel Stehule
Hi Yes, I did read your “schema variables” post on your site “Pavel Stehule’s > blog — Some notes about PostgreSQL”. It gives me a very good idea about > what you have in mind. > > But as I’ve come to understand the term “Functional Spec”, this denotes a > formal deliverable that a product develop

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-22 Thread Pavel Stehule
> > From PostgreSQL's SQL perspective the session variables are common > database objects (contra SQL/PL where package variables are SQL/PL language > objects), and SQL disallows ambiguity. This is a little bit more complex > problem, because session variables can be used everywhere in Postgres (no

Re: Packages, inner subprograms, and parameterizable anonymous blocks for PL/pgSQL

2021-12-23 Thread Pavel Stehule
> > Thank you very much indeed for this careful reply, Pavel—and for the links > to the threads on the Hackers list. A great deal is now clarified for me. > You said “I am not native speaker, and my English is very poor”. You’re > far, far, too modest. I am a native English speaker. And I often see

Re: Deprecating plans for PGPASSWORD environment variable as insecure

2021-12-27 Thread Pavel Stehule
Hi po 27. 12. 2021 v 9:55 odesílatel Alexey Murz Korepov napsal: > MySQL in version have deprecated the `MYSQL_PWD` environment variable, > because they considers this way as insecure, quote from > https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html#idm45429554761920 > : > > > Us

Re: psql command failing with error "undefined symbol: PQhostaddr"

2021-12-28 Thread Pavel Stehule
Hi út 28. 12. 2021 v 13:29 odesílatel Narendra katlamudi < narendra_katlam...@yahoo.co.in> napsal: > Hi Team > > When I use psql to connect a pg server, I am getting below error. Any > solution/pointers? > I have pg versions 11,12,13 installed on my system. > > /usr/lib/postgresql/13/bin/psql: sy

Re: Getting json-value as varchar

2022-01-06 Thread Pavel Stehule
Hi čt 6. 1. 2022 v 14:33 odesílatel Andreas Joseph Krogh napsal: > På torsdag 06. januar 2022 kl. 14:29:12, skrev David G. Johnston < > david.g.johns...@gmail.com>: > > [..] > The fact is that the ‘ - - > ‘ operator gives you the needed output. > > David J. > > > Yeah, I think that's the correct

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread Pavel Stehule
út 11. 1. 2022 v 10:54 odesílatel napsal: > Hi, > > I would like to submit a problem (bug ?) that I encountered while handling > temporary tables in plpgsql functions. > > First, if I create a TABLE and a TEMP TABLE with the same name, and I > request without specified the schema, the temporary t

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread Pavel Stehule
út 11. 1. 2022 v 16:51 odesílatel napsal: > ‌Hi, Thank you for pointing this part of the documentation. > It's actually works with EXECUTE 'INSERT INTO my_table VALUES((random() * > 100)::INT);'; INSTEAD OF INSERT INTO my_table VALUES((random() * 100)::INT); > And it's possible to suppose that th

Re: psql does not provide proper response

2022-01-20 Thread Pavel Stehule
čt 20. 1. 2022 v 19:50 odesílatel Bryn Llewellyn napsal: > > shishaozh...@gmail.com wrote: > > > > I do not know what happened. > > > > psql does not provide proper response anymore. > > > > I typed the following and see nothing. > > > > user=# select * from boundaryline.scotland_and_wales_const_

Re: Postgres Version Upgrade to 14.1 error

2022-02-03 Thread Pavel Stehule
Hi pá 4. 2. 2022 v 7:02 odesílatel rob stan napsal: > Hello, > > We have "pgq" extensions on our clusters when I am trying to upgrade from > 9.6.24 to 14.1 with pg_upgrade --link method, i am getting error; > > > First i was getting this error ; > > could not load library "$libdir/pgq_lowlevel":

Re: Can we go beyond the standard to make Postgres radically better?

2022-02-13 Thread Pavel Stehule
ne 13. 2. 2022 v 9:29 odesílatel Peter J. Holzer napsal: > On 2022-02-13 01:11:16 +0100, Andreas 'ads' Scherbaum wrote: > > On 12/02/2022 22:34, Peter J. Holzer wrote: > > > On 2022-02-12 22:09:25 +0100, Andreas 'ads' Scherbaum wrote: > > > > On 12/02/2022 20:50, Peter J. Holzer wrote: > > > > >

Re: Can we go beyond the standard to make Postgres radically better?

2022-02-13 Thread Pavel Stehule
ne 13. 2. 2022 v 10:45 odesílatel Guyren Howe napsal: > > The MySQL autocomplete is designed without context filtering. Maybe we can > have this implementation too (as alternative) > > so using all column names + all table names + aliases.column names (when > we know defined alias) > > Another id

Re: 2 phase commit with FDW

2022-02-18 Thread Pavel Stehule
Hi pá 18. 2. 2022 v 14:24 odesílatel Mladen Gogala napsal: > On 2/17/22 13:10, Mladen Gogala wrote: > > Hi! > > I am getting the following error when trying to PREPARE transaction which > updates both local and foreign table: > > 2/17/22 > 12:48:00:657 EST] 0128 RegisteredRes E WTRN0046E:

Re: Varbit and toast

2017-12-13 Thread Pavel Stehule
Hi 2017-12-13 16:22 GMT+01:00 Olga Lytvynova-Bogdanova < olytvynovabogdan...@gmail.com>: > Hello, > I would like to ask whether is VARBIT a TOAST-able type and table should > support row insertion with VARBIT values more than 8 KB in size thus? > Regards > Olha > postgres=# select * from pg_type

Re: Re: PostgreSQL needs percentage function

2017-12-18 Thread Pavel Stehule
2017-12-18 17:13 GMT+01:00 Nick Dro : > > Hi, > I know how to implement this. It's not the issue. > It's very easy to implement absolute value as well yet still PostgreSQL > gives abs(x) function which is build in function. > My claim is that if there is a build in function for absolute value why

Re: Re: PostgreSQL needs percentage function

2017-12-19 Thread Pavel Stehule
2017-12-19 10:13 GMT+01:00 Nick Dro : > This is exactly why I think there should be some build-in function for > that... > Percentage calculation exists in almost any databse and information system > - it requires from use to implement many functions on thier own for > something that is very basic

Re: Character set display

2017-12-19 Thread Pavel Stehule
Hi 2017-12-19 10:53 GMT+01:00 gregoryrevilla : > Sorry may be it is not an appropriate question directly for this topic but > how to make my app configured to use UTF8? > Thank you > what doesn't work? Can you send more informations? Regards Pavel > > > > - > Help for app promoters htt

Re: Migrating to postgresql from oracle

2017-12-23 Thread Pavel Stehule
Hi 2017-12-23 19:53 GMT+01:00 Timo Myyrä : > Hi, > > I'm preparing migration of our asset management system database from > Oracle 12c to > PostgreSQL 10. I'm using ora2pg and a bit of sed to mangle the SQL ready > for > import to pg but I've hit first problem: > ERROR: referenced relation "..."

Re: Does PostgreSQL check database integrity at startup?

2017-12-26 Thread Pavel Stehule
2017-12-26 14:44 GMT+01:00 Martin Marques : > El 26/12/17 a las 09:52, Edson Carlos Ericksson Richter escribió: > > Recently I had a problem with a base file with size 0 in a standby > server. > > > > This raised one question: does PostgreSQL (9.6.6) check base integrity > > at startup? > > > > At

Re: Does PostgreSQL check database integrity at startup?

2017-12-26 Thread Pavel Stehule
2017-12-26 16:37 GMT+01:00 Edson Carlos Ericksson Richter < rich...@simkorp.com.br>: > Em 26/12/2017 12:25, Pavel Stehule escreveu: > > > > 2017-12-26 14:44 GMT+01:00 Martin Marques > : > >> El 26/12/17 a las 09:52, Edson Carlos Ericksson Richter escribió: >

Re: Does PostgreSQL check database integrity at startup?

2017-12-26 Thread Pavel Stehule
2017-12-26 16:50 GMT+01:00 Edson Carlos Ericksson Richter < rich...@simkorp.com.br>: > Em 26/12/2017 13:40, Pavel Stehule escreveu: > > > > 2017-12-26 16:37 GMT+01:00 Edson Carlos Ericksson Richter < > rich...@simkorp.com.br>: > >> Em 26/12/2017 12:25, Pave

Re: OPtimize the performance of a query

2018-01-16 Thread Pavel Stehule
Hi 2018-01-16 17:44 GMT+01:00 hmidi slim : > Sorry I forget the lower command when I wrote the code, it is like this: > lower(g.country_code) like lower('US') > (lower(g.feature_class) like lowwer('P') or lower(g.feature_class) like > lower('L')) > please, don't do top post. Your query must be

Re: OPtimize the performance of a query

2018-01-16 Thread Pavel Stehule
ndexes? > https://en.wikipedia.org/wiki/Posting_style#Top-posting .. please, don't do it. IS DISTINCT FROM has sense if your data - or your queries has NULL. If not, and it is probably your case, then <> should be preferred. Regards Pavel > 2018-01-16 17:49 GMT+01:00 Pavel Steh

Re: OPtimize the performance of a query

2018-01-16 Thread Pavel Stehule
2018-01-16 19:35 GMT+01:00 hmidi slim : > Thank you for your advices and thanks for all people who give me some best > practises and useful ideas. > you are welcome Regards Pavel

Re: execute block like Firebird does

2018-02-11 Thread Pavel Stehule
2018-02-11 14:50 GMT+01:00 PegoraroF10 : > but DO doesn´t return values, or it does ? > > execute block returns(ID Integer, Name varchar(50), LastInvoice Date, ...) > as > begin > for select ID, Name from Customers where ... into ID, Name do begin > select bla, bla, bla from functionX(ID) in

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread Pavel Stehule
2018-02-16 13:31 GMT+01:00 mariusz : > > hello all, > > i just noticed some strange thing in plpgsql, that is keyword RETURN is > allowed as noop after a valid statement. > shame on me, after so many years of using plpgsql i happened to write a > bug omitting semicolon after statement just before

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Pavel Stehule
Hi 2018-02-16 13:20 GMT+01:00 Thiemo Kellner : > Hi all > > I would like to have a generic trigger function that compares on insert if > there is already a record in the table with the very same values. Using > PL/pgSQL ( I am not bound to that) I know the insert record structure from > the new r

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread Pavel Stehule
2018-02-16 14:20 GMT+01:00 mariusz : > On Fri, 2018-02-16 at 13:51 +0100, Pavel Stehule wrote: > > > > It is not a bug, it is feature. Sometimes not nice. RETURN is keyword > > in procedural part, but it is nothing in sql part. > > > thanks, i haven't thought

Re: shared_buffers 8GB maximum

2018-02-18 Thread Pavel Stehule
2018-02-18 14:41 GMT+01:00 Vitaliy Garnashevich : > > I certainly wouldn't recommend using 1/2 of RAM right away. There's a >> good chance it would be a waste of memory - for example due to double >> buffering, which effectively reduces "total" cache hit ratio. >> > > Double buffering is often men

Re: oracle to postgresql conversion tool

2018-02-21 Thread Pavel Stehule
Hi 2018-02-22 5:59 GMT+01:00 Marcin Giedz : > Hi, there are at least 5 tools I found on the PG list but could you > recommend well tested, free one ? we need to migrate production 30GB oracle > 11 db to postgres 9 and are looking for best approach. Of course if there > is no free/open solution an

Re: Trouble in generating the plpgsql procedure code

2024-09-30 Thread Pavel Stehule
Hi use format function do $$ begin for i in 1..10 loop execute format($_$ create or replace function %I(a int) returns int as $__$ begin return a + %s; end; $__$ language plpgsql; $_$, 'foo_' || i, i); end loop; end; $$; DO (2024-09-30 12:21:29) postgres=# \sf foo_1 CREATE OR REPLACE

Re: search_path for PL/pgSQL functions partially cached?

2024-12-27 Thread Pavel Stehule
pá 27. 12. 2024 v 22:03 odesílatel Tom Lane napsal: > "David G. Johnston" writes: > > It is what it is - and if one is not careful one can end up writing > > hard-to-understand and possibly buggy code due to the various execution > > environments and caches involved. > > Yeah, I don't see this c

Re: search_path for PL/pgSQL functions partially cached?

2024-12-27 Thread Pavel Stehule
Hi pá 27. 12. 2024 v 21:26 odesílatel David G. Johnston < david.g.johns...@gmail.com> napsal: > On Friday, December 27, 2024, Jan Behrens wrote: >> >> >> It seems that it matters *both* how the search_path was set during the >> *first* invocation of the function within a session *and* how it is

Re: search_path for PL/pgSQL functions partially cached?

2024-12-27 Thread Pavel Stehule
Hi > Maybe not many people run into these issues because schemas and > functions aren't used as often in combination? > I think schema and functions are common combinations. But when people have objects with the same name, then they are careful to be sure, so objects have really identical struct

Re: Logging queries executed by SPI_execute

2025-02-03 Thread Pavel Stehule
út 4. 2. 2025 v 5:09 odesílatel Marcelo Fernandes napsal: > On Mon, Feb 3, 2025 at 6:46 PM Pavel Stehule > wrote: > > The queries executed by SPI are never executed on the top level. These > queries are marked as nested. > > > > So you need to use auto_explain > h

Re: Logging queries executed by SPI_execute

2025-02-02 Thread Pavel Stehule
Hi po 3. 2. 2025 v 0:06 odesílatel Marcelo Fernandes napsal: > Hi there, > > I have been trying to debug what queries an extension is firing. After > reading > the code for the extension, I noticed that all the statements are fired > via the > SPI interface, most specifically, using the SPI_exec

Re: Request for new column in pg_namespace

2024-12-15 Thread Pavel Stehule
Hi ne 15. 12. 2024 v 17:59 odesílatel Ron Johnson napsal: > https://www.postgresql.org/docs/current/catalog-pg-namespace.html > > Currently, when I want to query all "userland" tables, I write something > like: > select ... > from pg_class cl, pg_namespace nsp > where cl.relnamespace = nsp.oid >

Re: PQexecParams and "SET TIME ZONE $1" gets 'syntax error at or near "$1" at character 15'

2024-11-23 Thread Pavel Stehule
Hi so 23. 11. 2024 v 16:01 odesílatel napsal: > I get get this same error > > syntax error at or near "$1" at character 15 > > if I feed "const char *command" with the following texts. > > SET TIME ZONE $1 > SET TIME ZONE $1::TEXT > > For some reasons, I can not add quotes around $1 as follows.

Re: search_path for PL/pgSQL functions partially cached?

2025-01-02 Thread Pavel Stehule
Hi čt 2. 1. 2025 v 11:37 odesílatel Jan Behrens napsal: > On Wed, 1 Jan 2025 11:19:32 -0700 > "David G. Johnston" wrote: > > > On Wed, Jan 1, 2025 at 10:55 AM Jan Behrens > wrote: > > > > > On Sat, 28 Dec 2024 00:40:09 +0100 > > > Jan Behrens wrote: > > > > > > > On Fri, 27 Dec 2024 13:26:28

Re: search_path for PL/pgSQL functions partially cached?

2025-01-02 Thread Pavel Stehule
čt 2. 1. 2025 v 13:15 odesílatel Jan Behrens napsal: > On Thu, 2 Jan 2025 12:40:59 +0100 > Pavel Stehule wrote: > > > How can you identify unwanted usage of non qualified identifiers from > > wanted usage of non qualified identifiers? It is a common pattern for > > sh

Re: search_path for PL/pgSQL functions partially cached?

2025-01-02 Thread Pavel Stehule
Hi > > > > some times can be pretty ineffective to have database per customer - more > > connect, disconnect in postgres is much more expensive than SET > search_path > > TO .. and maybe RESET plans; > > I guess that means there is a practical application where search_path > MAY change at runtime

Re: size of attributes table is too big

2025-03-19 Thread Pavel Stehule
st 19. 3. 2025 v 18:14 odesílatel Álvaro Herrera napsal: > Hello > > On 2025-Mar-19, Siraj G wrote: > > > I have a PG (v16) instance which is occupying around 1TB of storage. Out > of > > this, around 350GB is occupied by the table pg_catalog.pg_attribute. > > Why is the catalog table's size so b

Re: Error on the query

2025-03-04 Thread Pavel Stehule
Hi út 4. 3. 2025 v 18:30 odesílatel Igor Korot napsal: > Hi, ALL, > Trying to execute following query: > > [code] > queries.push_back( L"DO $$ BEGIN IF NOT EXISTS( SELECT 1 FROM > pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relname > = \'abcatc_x\' AND n.nspname = \'pub

Re: Determine server version from psql script

2025-03-23 Thread Pavel Stehule
Hi ne 23. 3. 2025 v 19:31 odesílatel Igor Korot napsal: > Hi, > > [code] > SELECT current_setting('server_version_num')::int > 13 as v13 > \gset > \if :v13 >CREATE OR REPLACE TRIGGER playersinleague_insert AFTER INSERT ON > playersinleague WHEN new.current_rank IS NULL >BEGIN >

<    1   2   3   4   5