This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Define the new tablespace name and the target table name | |
DO $$ | |
DECLARE | |
new_tablespace TEXT := 'new_tablespace_name'; | |
target_table TEXT := 'your_table_name'; -- Replace with the table name you want to move | |
BEGIN | |
-- Create a temporary table to store index names | |
CREATE TEMP TABLE temp_indexes AS | |
SELECT indexname | |
FROM pg_indexes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// instrumentedWriter is a wrapper around gin.ResponseWriter that calls | |
// BeforeWriteHeaderCallback before response headers is written. | |
type instrumentedWriter struct { | |
gin.ResponseWriter | |
BeforeWriteHeaderCallback func() | |
} | |
func (w *instrumentedWriter) Write(data []byte) (int, error) { | |
w.runBeforeWriteHeaderCallbackOnce() | |
return w.ResponseWriter.Write(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Doctrine; | |
use Doctrine\DBAL\Connection; | |
use Doctrine\DBAL\Driver\PDOPgSql\Driver as PDOPgSqlDriver; | |
use Doctrine\ORM\NativeQuery; | |
class PgSqlNativeQueryCursor | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with recursive source as ( | |
select (220000000000::bigint + round(random() * 10000000000))::bigint as code | |
from generate_series(1, 10000) | |
), | |
checksum_calc as ( | |
select code, 3 as cs_mult, 0::bigint as checksum, code as interm_code from source | |
union | |
select | |
code, | |
(case when cs_mult = 3 then 1 else 3 end) as cs_mult, |