Re: [GENERAL] EXCLUDE constraint with not equals

2015-03-03 Thread Emre Hasegeli
> Given the following table, I would like to ensure that all the rows for an > email that have a user defined map to the same user. > > CREATE TABLE person ( > id INTEGER PRIMARY KEY, > user TEXT, > email TEXT NOT NULL); > > > What I think I'm looking for is something like this: > > CREATE TA

Re: [GENERAL] Shouldn't "WHEN (OLD.* IS DISTINCT FROM NEW.*)" clause be independent from data type?

2015-10-04 Thread Emre Hasegeli
> The other line of attack would be to deprecate all the fuzzy comparison > behavior in the geometric types, and just make it exact. Don't know how > much pain that would add, but surely it would also subtract some. How can we go forward about this? The current state of the operators stand in th

Re: [GENERAL] BRIN indexes

2016-01-29 Thread Emre Hasegeli
>> From the above, may I presume that it is best to cluster (or sort), the >> table based on the intended >> BRIN column(s) before actually creating the index to insure the pages are >> adjacent? If so, should >> that not be included in the documentation, instead of implied? The same question is

Re: [GENERAL] Custom column ordering

2016-03-05 Thread Emre Hasegeli
> - Why is PostgreSQL not using the functional index I created and why is it > not being ordered correctly? Your example works for me: > hasegeli=# CREATE TABLE device_port (port text); > CREATE TABLE > > hasegeli=# CREATE INDEX idx_device_port_port_proper ON device_port > (cast_to_port(port)

Re: [GENERAL] Custom column ordering

2016-03-07 Thread Emre Hasegeli
> Although, I do find your output very strange. You wrote ORDER BY port, which > is a text type. Why does Postgres order using the ordering operators of the > "Port" data type rather than the "text" type, even though you haven't > performed a cast? That is an editing mistake. I mean > hasegeli=#

Re: [GENERAL] Unique values on multiple tables

2016-03-28 Thread Emre Hasegeli
> I have 2 tables and I must make asure unique values like this. > > table1 > id > nr - integer > > table2 > id > id_table1 - FK in Table 1 > valid_from - timestamp > > There must be unique values for: > - nr - from table1 > and > - YEAR(MIN(valid_from)) from table 2 In situations like this, I add

Re: [GENERAL] Unique values on multiple tables

2016-03-28 Thread Emre Hasegeli
> Could I use lock tables to fix this? Is postgres automaticaly locking a > table while running a trigger on that table? You can use LOCK TABLE. See the documentation: http://www.postgresql.org/docs/current/static/explicit-locking.html -- Sent via pgsql-general mailing list (pgsql-general@post

Re: [GENERAL] Trying to create array of enum to array of text for exclusion constraint

2016-05-28 Thread Emre Hasegeli
> or is there something built in that I have missed? The intarray extension in the contrib provides a GiST operator class for int[]. That can be used with exclusion constraints: > hasegeli=# create extension intarray; > CREATE EXTENSION > > hasegeli=# create type e as enum ('a', 'b'); > CREATE T

Re: [GENERAL] which view is used another views

2011-03-24 Thread Emre Hasegeli
On 24 March 2011 18:06, salah jubeh wrote: > Hello, > > How can I determine the views which are using a certain view. > > Name of the view can be searched on the "view_definition" column of the "views" view of the information schema.

Re: [GENERAL] which view is used another views

2011-03-25 Thread Emre Hasegeli
On 25 March 2011 19:13, salah jubeh wrote: > Hello Guys > > The query in this function returns the dependency for level one. However, I > need the dependency for all level. I am still new with plpgsql so; how can I > use recursive function to return all dependency for all levels > > CREATE OR REP

Re: [GENERAL] Examples of projects that use Postgres "as API server"

2014-06-30 Thread Emre Hasegeli
> I've been using Postgres for a small project and I've been very impressed > by its flexibility in defining new types and functions. I very much like > having the ability to define a clean relational model and then a set of > functions that act as the API to the data stored in my model. > > Does

Re: [GENERAL] PostgreSQL 9.2.3 performance problem caused Exclusive locks

2013-03-12 Thread Emre Hasegeli
2013-03-08 13:27:16 +0200 Emre Hasegeli : PostgreSQL writes several following logs during the problem which I never saw before 9.2.3: LOG: process 4793 acquired ExclusiveLock on extension of relation 305605 of database 16396 after 2348.675 ms I tried * to downgrade to 9.2.2 * to disable

Re: [GENERAL] appropriate column for storing ipv4 address

2017-03-02 Thread Emre Hasegeli
> Maybe it will be useful for you! Or maybe there is already some built-in way > to treat cidr columns like ranges? There is GiST operator class since version 9.4 and SP-GiST operator class on version 9.6: CREATE INDEX ON tracked_ip_address USING gist (ip_address inet_ops); CREATE INDEX ON track

Re: [GENERAL] Default operator class for data type boolean for access method gist is missing

2014-03-23 Thread Emre Hasegeli
2014-03-23, Andreas Joseph Krogh : > I'm trying to define the following exclusion-constraint > > > *alter table *my_table *add EXCLUDE USING gist *(is_default *WITH *=, > *daterange*(valid_from, valid_to, *'[)'*) *WITH *&&) *WHERE *(is_default = > *true*); > > is_default should not be in the ind