Re: [Django] #27478: JSONB_AGG is not available in PostgreSQL 9.4

2016-11-12 Thread Django
#27478: JSONB_AGG is not available in PostgreSQL 9.4
-+-
 Reporter:  Christian von|Owner:  nobody
  Roques |
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  contrib.postgres |  Version:  master
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  JsonAgg JSONB_AGG| Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => duplicate
 * component:  Uncategorized => contrib.postgres


Comment:

 Since the new feature isn't released, we can reopen the original ticket to
 keep the discussion in one place. Thanks for the report.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.1181ebfee1b98198c153907bdf0b654e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27478: JSONB_AGG is not available in PostgreSQL 9.4

2016-11-12 Thread Django
#27478: JSONB_AGG is not available in PostgreSQL 9.4
-+-
 Reporter:  Christian von|Owner:  nobody
  Roques |
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Uncategorized|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  JsonAgg JSONB_AGG| Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mads Jensen):

 Seems good. You may need to refer this ticket in the commit #26327.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.153d48fc9798347c736ba32b0a409557%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27478: JSONB_AGG is not available in PostgreSQL 9.4

2016-11-11 Thread Django
#27478: JSONB_AGG is not available in PostgreSQL 9.4
-+-
   Reporter:  Christian  |  Owner:  nobody
  von Roques |
   Type: | Status:  new
  Cleanup/optimization   |
  Component: |Version:  master
  Uncategorized  |
   Severity:  Normal |   Keywords:  JsonAgg JSONB_AGG
   Triage Stage: |  Has patch:  1
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 `django.contrib.postgres.aggregates.general.JsonAgg` uses `JSONB_AGG`. The
 Django test-suite contains a test which fails due to `JSONB_AGG` being
 unavailable as shown below when run against PostgreSQL 9.4. The test is
 already marked as `@skipUnlessDBFeature('has_jsonb_datatype')`, but JSONB
 became available with PostgreSQL 9.4 and `JSONB_AGG` was added in
 PostgreSQL 9.5.
 I currently see three possibilities:
  1. Add a new feature `has_jsonb_agg` and make the test
 `@skipUnlessDBFeature('has_jsonb_agg')`
  2. Add a new feature `has_jsonb_agg` and use `JSON_AGG` instead of
 `JSONB_AGG` when `JSONB_AGG` is unavailable.
 3. Have `has_jsonb_datatype` lie about it not being available in
 PostgreSQL 9.4.
 I prefer and have implemented option 2 and really don't like option 3.

 See my [https://github.com/roques/django/tree/jsonb_agg branch] for my
 initial implementation. — Is there a cleaner way to achieve this besides
 redefining `JsonAgg.as_sql`?

 {{{
 ERROR: test_json_agg (postgres_tests.test_aggregates.TestGeneralAggregate)
 --
 Traceback (most recent call last):
   File "/usr/lib/python3.4/unittest/case.py", line 58, in testPartExecutor
 yield
   File "/usr/lib/python3.4/unittest/case.py", line 577, in run
 testMethod()
   File "/home/roques/tools/django/django/test/testcases.py", line 1113, in
 skip_wrapper
 return test_func(*args, **kwargs)
   File
 "/home/roques/tools/django/tests/postgres_tests/test_aggregates.py", line
 122, in test_json_agg
 values =
 AggregateTestModel.objects.aggregate(jsonagg=JsonAgg('char_field'))
   File "/home/roques/tools/django/django/db/models/manager.py", line 85,
 in manager_method
 return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/home/roques/tools/django/django/db/models/query.py", line 352, in
 aggregate
 return query.get_aggregation(self.db, kwargs.keys())
   File "/home/roques/tools/django/django/db/models/sql/query.py", line
 461, in get_aggregation
 result = compiler.execute_sql(SINGLE)
   File "/home/roques/tools/django/django/db/models/sql/compiler.py", line
 829, in execute_sql
 cursor.execute(sql, params)
   File "/home/roques/tools/django/django/db/backends/utils.py", line 64,
 in execute
 return self.cursor.execute(sql, params)
   File "/home/roques/tools/django/django/db/utils.py", line 94, in
 __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "/home/roques/tools/django/django/utils/six.py", line 685, in
 reraise
 raise value.with_traceback(tb)
   File "/home/roques/tools/django/django/db/backends/utils.py", line 64,
 in execute
 return self.cursor.execute(sql, params)
 django.db.utils.ProgrammingError: function jsonb_agg(character varying)
 does not exist
 LINE 1: SELECT JSONB_AGG("postgres_tests_aggregatetestmodel"."char_f...
^
 HINT:  No function matches the given name and argument types. You might
 need to add explicit type casts.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.e825a522895657f0220eb459f31690e6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.