Re: PostgreSQL 9.6: view based on sequence

2018-01-25 Thread Enrico Pirozzi
I found this db, it's not mine Thanks ;) Enrico Il 25/01/2018 18:07, Peter Eisentraut ha scritto: There is nothing from with user code using the data type "name". It's probably just not the best choice. But if you create a view over a system table, then you'll get whatever types the system

Re: PostgreSQL 9.6: view based on sequence

2018-01-25 Thread Peter Eisentraut
On 1/24/18 06:52, Enrico Pirozzi wrote: > PostgreSQL creates a view based on the sequence and the strange thing > is that, among the various fields that are created in the view, > there is a field named sequence_name with datatype name. > > I've seen in the docs > https://www.postgresql.org/

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Enrico Pirozzi
It is all documented here: https://www.postgresql.org/docs/10/static/release-10.html#idm46428658049888 "...selecting from a sequence relation now returns only the three fields named above." And there's no way to keep portability from 9.x to 10.x Thanks ;) Enrico -- Enrico Pirozzi e.piro.

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Vincenzo Romano
2018-01-24 14:52 GMT+01:00 Enrico Pirozzi : > Yes the query is legal,but if you use pg_upgrade to upgrade from 9.6 to 10.x > , pg_upgrade will fail . > > Enrico > > > > Il 24/01/2018 13:11, Vincenzo Romano ha scritto: >> >> Those queries are all legal. No warning is due. > > > -- > Enrico Pirozzi >

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Enrico Pirozzi
Yes the query is legal,but if you use pg_upgrade to upgrade from 9.6 to 10.x , pg_upgrade will fail . Enrico Il 24/01/2018 13:11, Vincenzo Romano ha scritto: Those queries are all legal. No warning is due. -- Enrico Pirozzi e.piro...@nbsgroup.it

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Vincenzo Romano
2018-01-24 13:10 GMT+01:00 Enrico Pirozzi : > it's just to know why postgresql does not return a warning. > > > > Il 24/01/2018 13:06, Vincenzo Romano ha scritto: >> >> I haven't any v9 any more in my deployments. Sorry. >> >> What is the objective of that view? >> If it's to hide the nextval() fun

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Enrico Pirozzi
it's just to know why postgresql does not return a warning. Il 24/01/2018 13:06, Vincenzo Romano ha scritto: I haven't any v9 any more in my deployments. Sorry. What is the objective of that view? If it's to hide the nextval() function, then the solution can be similar to mine. If it's to acce

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Vincenzo Romano
2018-01-24 13:02 GMT+01:00 Enrico Pirozzi : > >> tmp1=# create sequence x; >> CREATE SEQUENCE >> Time: 69,857 ms >> tmp1=# select * from x; >> last_value | log_cnt | is_called >> +-+--- >> 1 | 0 | f >> (1 row) >> >> Maybe what you want to do is >> >> crea

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Enrico Pirozzi
tmp1=# create sequence x; CREATE SEQUENCE Time: 69,857 ms tmp1=# select * from x; last_value | log_cnt | is_called +-+--- 1 | 0 | f (1 row) Maybe what you want to do is create view v_test_sequence as select nextval( 'test_sequence' ); Ciao. Yes but

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Enrico Pirozzi
tmp1=# create sequence x; CREATE SEQUENCE Time: 69,857 ms tmp1=# select * from x; last_value | log_cnt | is_called +-+--- 1 | 0 | f (1 row) Maybe what you want to do is create view v_test_sequence as select nextval( 'test_sequence' ); Ciao. Yes bu

Re: PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Vincenzo Romano
2018-01-24 12:52 GMT+01:00 Enrico Pirozzi : > Hi, I was doing a test on a 9.6 and I've seen a strange thing > > if I run > > create sequence test_sequence; > create view v_test_sequence as select * from test_sequence; > > PostgreSQL creates a view based on the sequence and the strange thing is > t

PostgreSQL 9.6: view based on sequence

2018-01-24 Thread Enrico Pirozzi
Hi, I was doing a test on a 9.6 and I've seen a strange thing if I run create sequence test_sequence; create view v_test_sequence as select * from test_sequence; PostgreSQL creates a view based on the sequence and the strange thing is that, among the various fields that are created in the vie