Re: CLUSTER, VACUUM, and TABLESPACEs (oh my)

2021-01-24 Thread Demitri Muna
> On Jan 24, 2021, at 9:03 PM, Guillaume Lelarge wrote: > >> VACUUM FULL unclusters the table?? > > It will rebuild the table without sorting the data according to the index > used with CLUSTER (without any sorting actually). Thank you for the clarification; that’s very helpful. For the

CLUSTER, VACUUM, and TABLESPACEs (oh my)

2021-01-24 Thread Demitri Muna
Hi, I would like to request a little clarification on the CLUSTER and VACUUM commands. My use case here (partially) is when my disk runs out of space and I want to move a table to a newly created tablespace. These questions somewhat overlap. Let’s say I am starting with a table that is not

Re: Getting "could not read block" error when creating an index on a function.

2021-01-03 Thread Demitri Muna
30, 2020, at 3:14 PM, Tom Lane wrote: > > Karsten Hilbert writes: >> Am Wed, Dec 30, 2020 at 02:37:59PM -0500 schrieb Demitri Muna: >>> I want to index the results of these repeated, unchanging calculations to >>> speed up other queries. Which mechanism would be best t

Re: Getting "could not read block" error when creating an index on a function.

2020-12-30 Thread Demitri Muna
Hi Tom, > On Dec 30, 2020, at 11:50 AM, Tom Lane wrote: > > I would call this a bug if it were a supported case, but really you are > doing something you are not allowed to. Functions in indexed expressions > are required to be immutable, and a function that looks at the contents of > a table

Getting "could not read block" error when creating an index on a function.

2020-12-30 Thread Demitri Muna
Hello, I’m getting stuck on a problem I was hoping I could get some help with. I’m trying to create an index for the results of a function that touches two tables like this and get the following error: CREATE INDEX my_idx ON mytable (first_time(id)); ERROR: could not read block 0 in file

Re: ddl_command_end not firing DROP events

2018-07-08 Thread Demitri Muna
Hi, On Jul 8, 2018, at 2:19 PM, Alvaro Herrera wrote: > As I recall, handling of DROP events in the ddl_command_end event is not > completely consistent. You may even find that some DROP events are not > returned by pg_event_trigger_ddl_commands. I suggest you stick to >

ddl_command_end not firing DROP events

2018-07-08 Thread Demitri Muna
Hi, I’ve created a trigger where I want to capture schema-changing events. I’m finding that DROP events are not being triggered when using “ddl_command_end". The test case below demonstrates this. I am running PostgreSQL 10.4. The trigger is fired for the CREATE event, but not DROP TYPE or

Re: Location to specify C compiler option in C extension

2018-02-23 Thread Demitri Muna
Hi Tom, > PG_CPPFLAGS ought to work. One point is that you need to set that before > including pgxs.mk; maybe it's an ordering problem? On closer inspection, it was working, but the pg Makefile was specifically including “-Wdeclaration-after-statement” which I think was overriding the

Location to specify C compiler option in C extension

2018-02-23 Thread Demitri Muna
Hi, I’m writing a C extension and have successfully based my Makefile on existing templates. This conveniently hides the details of the full Makefile provided by "pg_config --pgxs”. Which variable would be the appropriate one to specify the ‘-std=c99’ compiler flag? I’ve tried many and still

Re: Getting a primitive numeric value from "DatumGetNumeric"?

2018-02-23 Thread Demitri Muna
Hi, On Feb 22, 2018, at 9:31 PM, Michael Paquier wrote: > PG_GETARG_NUMERIC(), no? That function returns an object of datatype “Numeric” which still requires some (not immediately obvious) conversation to a double (or whatever primitive C type). > When working on

Re: Getting a primitive numeric value from "DatumGetNumeric"?

2018-02-22 Thread Demitri Muna
Hi Tom, On Feb 20, 2018, at 10:54 PM, Tom Lane wrote: > Well, the implicit coercions work in your favor in this particular case. Ah, I wasn’t aware of implicit coercion. Yes, that solves the problem perfectly, thanks. Out of curiosity, how does one read a numeric type

Getting a primitive numeric value from "DatumGetNumeric"?

2018-02-20 Thread Demitri Muna
Hi, I’m writing a C extension for PostgreSQL. One possible input datatype for my function is a numeric array, e.g. ARRAY[[1.5,2.5],[3.5,4.5]]. I can use “DatumGetNumeric” to extract a “Numeric” data type from the data, but at some point I need to convert this to a number (e.g. double) so that