Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread David G. Johnston
Please don't top-post on these lists. On Sun, Mar 12, 2017 at 12:00 AM, vod vos wrote: > Maybe CHECK (goose >= 100 AND goose <= -100) works better, But if : > > INSERT INTO test VALUES (1, 59.2); > INSERT INTO test VALUES (1, 59.24); > INSERT INTO test VALUES (1, 59.26); >

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Charles Clavadetscher
Hello > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of vod vos > Sent: Sonntag, 12. März 2017 08:01 > To: Pavel Stehule > Cc: pgsql-general > Subject: Re:

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread vod vos
Maybe CHECK (goose >= 100 AND goose <= -100) works better, But if : INSERT INTO test VALUES (1, 59.2); INSERT INTO test VALUES (1, 59.24); INSERT INTO test VALUES (1, 59.26); INSERT INTO test VALUES (1, 59.2678); The INSERT action still can be done. What I want is just how to limit the length

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread David G. Johnston
On Sat, Mar 11, 2017 at 11:14 PM, vod vos wrote: > > Hi everyone, > > How to define the exact limit length of numeric type? For example, > > CREATE TABLE test (id serial, goose numeric(4,1)); > > ​[...] > 30.2 can be inserted into COLUMN goose, but I want 30.2 > ​[...] > can

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Pavel Stehule
2017-03-12 7:25 GMT+01:00 Pavel Stehule : > > > 2017-03-12 7:14 GMT+01:00 vod vos : > >> >> Hi everyone, >> >> How to define the exact limit length of numeric type? For example, >> >> CREATE TABLE test (id serial, goose numeric(4,1)); >> >> 300.2 and

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Pavel Stehule
2017-03-12 7:14 GMT+01:00 vod vos : > > Hi everyone, > > How to define the exact limit length of numeric type? For example, > > CREATE TABLE test (id serial, goose numeric(4,1)); > > 300.2 and 30.2 can be inserted into COLUMN goose, but I want 30.2 or 3.2 > can not be inserted,

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Christoph Moench-Tegeder
## vod vos (vod...@zoho.com): > How to define the exact limit length of numeric type? For example, > > CREATE TABLE test (id serial, goose numeric(4,1)); > > 300.2 and 30.2 can be inserted into COLUMN goose, but I want 30.2 > or 3.2 can not be inserted, how to do this? testing=# CREATE TABLE

Re: [GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread Charles Clavadetscher
Hello > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of vod vos > Sent: Sonntag, 12. März 2017 07:15 > To: pgsql-general > Subject: [GENERAL] How to define the limit length for numeric

[GENERAL] How to define the limit length for numeric type?

2017-03-11 Thread vod vos
Hi everyone, How to define the exact limit length of numeric type? For example, CREATE TABLE test (id serial, goose numeric(4,1)); 300.2 and 30.2 can be inserted into COLUMN goose, but I want 30.2 or 3.2 can not be inserted, how to do this? Thank you. -- Sent via pgsql-general mailing

Re: [GENERAL] Index using in jsonb query

2017-03-11 Thread John R Pierce
On 3/11/2017 3:55 PM, SuperCiccio wrote: Is there a way to make the following query use some sort of indexing? select field1,field2 from datatable where (jsonfield#>>'{path1,path2}')::numeric < 1000; if the '{path1,path2}' part is constant, I'd think you could create an index on (jsonfield

[GENERAL] Index using in jsonb query

2017-03-11 Thread SuperCiccio
Is there a way to make the following query use some sort of indexing? select field1,field2 from datatable where (jsonfield#>>'{path1,path2}')::numeric < 1000; Thanks

Re: [GENERAL] CHECK for 2 FKs to be non equal

2017-03-11 Thread Alexander Farber
Thank you Alban and Francisco - On Sat, Mar 11, 2017 at 11:52 AM, Alban Hertroys wrote: > > > On 11 Mar 2017, at 10:41, Alexander Farber > wrote: > > uid integer NOT NULL REFERENCES words_users(uid) CHECK (uid <> > author) ON DELETE

Re: [GENERAL] CHECK for 2 FKs to be non equal

2017-03-11 Thread Alban Hertroys
> On 11 Mar 2017, at 10:41, Alexander Farber wrote: > > uid integer NOT NULL REFERENCES words_users(uid) CHECK (uid <> > author) ON DELETE CASCADE, > but get syntax error in 9.5: > > ERROR: syntax error at or near "ON" > LINE 2: ...REFERENCES

Re: [GENERAL] CHECK for 2 FKs to be non equal

2017-03-11 Thread Francisco Olarte
Alexander: On Sat, Mar 11, 2017 at 10:41 AM, Alexander Farber wrote: > uid integer NOT NULL REFERENCES words_users(uid) CHECK (uid <> > author) ON DELETE CASCADE, Maybe a stupid question, but have you tried "refereces.. on delete .. check"? I mean, the

[GENERAL] CHECK for 2 FKs to be non equal

2017-03-11 Thread Alexander Farber
Good morning, I am trying to add a table holding player reviews of each other: words=> CREATE TABLE words_reviews ( uid integer NOT NULL REFERENCES words_users(uid) CHECK (uid <> author) ON DELETE CASCADE, author integer NOT NULL REFERENCES words_users(uid) ON DELETE CASCADE,