Hi,
SELECT "pg_attribute"."attname" AS "name", CAST("pg_attribute"."atttypid"
AS integer) AS "oid", CAST("basetype"."oid" AS integer) AS "base_oid",
format_type("basetype"."oid", "pg_type"."typtypmod") AS "db_base_type",
format_type("pg_type"."oid", "pg_attribute"."atttypmod") AS "db_type",
pg
Well,
params = [{
Sequel[:stacks][:organization_id] => *@user*.id,
Sequel[:stacks][:channel_id] => @channel.id, // or nil
}]
Solved my problem. Let me know if there is a better way...
On Wednesday, November 20, 2019 at 2:21:31 AM UTC+3, xura wrote:
&g
t; IS NULL))
OR (("user_id" = 1)
AND ("channel_id" = 5)))
AND ("apps"."properties" IS NULL))
On Wednesday, November 20, 2019 at 2:03:20 AM UTC+3, xura wrote:
>
> SELECT
> "stacks".*
> FROM "stacks"
> INNER JOIN "ap
SELECT
"stacks".*
FROM "stacks"
INNER JOIN "apps"
ON ("apps"."id" = "stacks"."app_id")
WHERE "user_id" = 1)
AND ("channel_id" IS NULL)))
AND ("apps"."properties" IS NULL))
Hi Jeremy,
In this query, *user_id* is ambiguous. It exists on both table. How can i
make sure its targeted for
Whoops.
.exclude { organizations[:id] =~ excluded_ids }
Solved.
On Saturday, September 28, 2019 at 2:08:42 AM UTC+3, xura wrote:
>
> Hi Jeremy,
>
> I have bucket and bucket_members tables. I join them together and i want
> to exclude some bucket.id.
>
>
Hi Jeremy,
I have bucket and bucket_members tables. I join them together and i want to
exclude some bucket.id.
excluded_ids = [1,2,3]
DB.select { buckets.* }
.join(:bucket_members, bucket_id: :id)
.where { bucket_members[:user_id] =~ id }
.exclude(buckets[:id] =>
Worked, as always!
Thank you Jeremy!
On Tuesday, August 13, 2019 at 11:19:30 PM UTC+3, Jeremy Evans wrote:
>
> On Tuesday, August 13, 2019 at 1:05:12 PM UTC-7, xura wrote:
>>
>> Hi,
>>
>> How can I translate this query to Sequel/Ruby? Does Sequel has ability to
;simple' AS regconfig), (COALESCE("adresses", ''))) @@ t...
^
DETAIL: The input string ended unexpectedly.
CONTEXT: JSON data, line 1:
On Tuesday, August 13, 2019 at 11:05:12 PM UTC+3, xura wrote:
>
> Hi,
>
Hi,
How can I translate this query to Sequel/Ruby? Does Sequel has ability to
handle such queries or do i need to execute raw?
SELECT * FROM contacts WHERE to_tsvector('English', addresses ->> 'address')
@@ to_tsquery('Heimdall')
Thanks!
--
You received this message because you are subscrib
Done it.
.where(DB.select(1).from{jsonb_array_elements(send_to).as(:t, [:to])}.where
(~Sequel.ilike(to.get_text('name'), 'john')).exists)
On Sunday, May 26, 2019 at 8:11:41 PM UTC+3, xura wrote:
>
> One last question here. Sorry for my questions today! Actually
What I've tried so far:
.where(DB.select{jsonb_array_elements(send_to)}.exists)
But expected output is *SELECT 1* for example. Actual is only SELECT (..
On Sunday, May 26, 2019 at 8:11:41 PM UTC+3, xura wrote:
>
> One last question here. Sorry for my questions today! Actually two
One last question here. Sorry for my questions today! Actually two question
in one row.
I have jsonb field which is like this:
[
{
"name": "Mark",
},
{
"name": "John",
}
]
As you can see objects are in single array. I want to search John for
example but i want to use regex like "jo*"
I was playing with Sequel.| however i missed asterisk there "*".
Thank you a million time, Jeremy! You saved my day!
On Sunday, May 26, 2019 at 6:10:45 PM UTC+3, xura wrote:
>
> I have this hash:
>
> fields = {
> name: 'John',
> subject: 'He
There is also boolean in it:
fields = [
{
name: 'John',
subject: 'Hello',
is_ok: true
},
{
name: 'Mark',
subject: 'Hi',
is_ok: false
}
]
On Sunday, May 26, 2019 at 6:10:45 PM UTC+3, xura wrote:
>
> I have this hash
I have this hash:
fields = {
name: 'John',
subject: 'Hello'
}
And I send this hash by this:
Email.where(fields).where(another_condition: 4).all
It works, however, When I want to add OR I need to explicitly define them:
fields = [
{
name: 'John',
subject: 'Hello'
},
{
name:
Hi,
Following is an :gin index for jsonb fields:
CREATE INDEX index_name
ON public.emails
USING gin
(send_cc, send_bcc, send_to, sender);
So, in Sequel docs no :Gin mentioned. Is there a better way to do this
without writing RAW SQL inside migrations?
--
You received this message beca
Thanks Jeremy. It works!
On Friday, May 24, 2019 at 5:28:28 PM UTC+3, Jeremy Evans wrote:
>
> On Friday, May 24, 2019 at 6:22:53 AM UTC-7, xura wrote:
>>
>> In fact, query is now like this:
>>
>> SELECT DISTINCT ON (jj->>'email') jj->>'
In fact, query is now like this:
SELECT DISTINCT ON (jj->>'email') jj->>'email', jj->>'name' , count(*)
over(partition by jj->>'email' )
from emails
join lateral jsonb_array_elements(send_to) j(jj) on true
ORDER BY jj->>&
text('email'))
However, i couldn't properly write this line:
CROSS JOIN LATERAL *jsonb_array_elements**(sr.receiver) x (e)*
On Friday, May 24, 2019 at 12:55:01 PM UTC+3, xura wrote:
>
> Hi,
>
> Is it possible to write this query with Sequel?
>
>
Hi,
Is it possible to write this query with Sequel?
SELECT DISTINCT ON (x.e->>'email')
x.e->>'email' as email,
x.e->>'name' as name
FROM messages sr
CROSS JOIN LATERAL jsonb_array_elements(sr.receiver) x (e)
ORDER BY x.e->>'email', id desc
Or I use *with_sql?
20 matches
Mail list logo