Sindre
Sindre8mo ago

postgres sql bind varaiables

select now() - interval '$1' as end is there a way to get $1 to work
No description
6 Replies
rubenf
rubenf8mo ago
yes, $1::text
Sindre
Sindre8mo ago
Wow. nice AI! thanks
No description
Sindre
Sindre8mo ago
haha. but it did not work :\
Sindre
Sindre8mo ago
did not work either. but then I guess it just how it is
No description
rubenf
rubenf8mo ago
1 year but let me find the fix this works: select interval '1'::text ' year'; so try this: ``` select interval $1::text ' year';
```
select concat($1::text, ' year')::interval;
```
select concat($1::text, ' year')::interval;
Sindre
Sindre8mo ago
thanks! that worked
No description